libweston: Properly namespace modules entrypoint

Use different functions so we cannot load a libweston common module in
weston directly or the other way around.

Signed-off-by: Quentin Glidic <sardemff7+git@sardemff7.net>
Reviewed-by: Daniel Stone <daniels@collabora.com>
diff --git a/compositor/cms-colord.c b/compositor/cms-colord.c
index 152a734..ae3ef25 100644
--- a/compositor/cms-colord.c
+++ b/compositor/cms-colord.c
@@ -34,6 +34,7 @@
 #include <colord.h>
 
 #include "compositor.h"
+#include "weston.h"
 #include "cms-helper.h"
 #include "shared/helpers.h"
 
diff --git a/compositor/systemd-notify.c b/compositor/systemd-notify.c
index 49e51f4..ce18ede 100644
--- a/compositor/systemd-notify.c
+++ b/compositor/systemd-notify.c
@@ -34,6 +34,7 @@
 #include "shared/string-helpers.h"
 #include "shared/zalloc.h"
 #include "compositor.h"
+#include "weston.h"
 
 struct systemd_notifier {
 	int watchdog_time;
diff --git a/compositor/weston.h b/compositor/weston.h
index bb04002..2e0417c 100644
--- a/compositor/weston.h
+++ b/compositor/weston.h
@@ -64,6 +64,10 @@
 wet_load_module(const char *name, const char *entrypoint);
 
 int
+module_init(struct weston_compositor *compositor,
+	    int *argc, char *argv[]);
+
+int
 wet_load_xwayland(struct weston_compositor *comp);
 
 struct text_backend;
diff --git a/fullscreen-shell/fullscreen-shell.c b/fullscreen-shell/fullscreen-shell.c
index daf024e..af77474 100644
--- a/fullscreen-shell/fullscreen-shell.c
+++ b/fullscreen-shell/fullscreen-shell.c
@@ -34,6 +34,7 @@
 #include <assert.h>
 
 #include "compositor.h"
+#include "compositor/weston.h"
 #include "fullscreen-shell-unstable-v1-server-protocol.h"
 #include "shared/helpers.h"
 
diff --git a/libweston/compositor.c b/libweston/compositor.c
index 2660264..5e23277 100644
--- a/libweston/compositor.c
+++ b/libweston/compositor.c
@@ -5409,14 +5409,12 @@
 WL_EXPORT int
 weston_compositor_load_xwayland(struct weston_compositor *compositor)
 {
-	int (*module_init)(struct weston_compositor *ec,
-			   int *argc, char *argv[]);
-	int argc = 0;
+	int (*module_init)(struct weston_compositor *ec);
 
-	module_init = weston_load_module("xwayland.so", "module_init");
+	module_init = weston_load_module("xwayland.so", "weston_module_init");
 	if (!module_init)
 		return -1;
-	if (module_init(compositor, &argc, NULL) < 0)
+	if (module_init(compositor) < 0)
 		return -1;
 	return 0;
 }
diff --git a/libweston/compositor.h b/libweston/compositor.h
index 1e57b3f..b049c98 100644
--- a/libweston/compositor.h
+++ b/libweston/compositor.h
@@ -1818,8 +1818,7 @@
 weston_backend_init(struct weston_compositor *c,
 		    struct weston_backend_config *config_base);
 int
-module_init(struct weston_compositor *compositor,
-	    int *argc, char *argv[]);
+weston_module_init(struct weston_compositor *compositor);
 
 void
 weston_transformed_coord(int width, int height,
diff --git a/tests/plugin-registry-test.c b/tests/plugin-registry-test.c
index 7fc88f3..2a32e01 100644
--- a/tests/plugin-registry-test.c
+++ b/tests/plugin-registry-test.c
@@ -28,6 +28,7 @@
 #include <assert.h>
 
 #include "compositor.h"
+#include "compositor/weston.h"
 #include "plugin-registry.h"
 
 static void
diff --git a/tests/surface-global-test.c b/tests/surface-global-test.c
index 55899c6..20d99ce 100644
--- a/tests/surface-global-test.c
+++ b/tests/surface-global-test.c
@@ -29,6 +29,7 @@
 #include <stdint.h>
 
 #include "compositor.h"
+#include "compositor/weston.h"
 
 static void
 surface_to_from_global(void *data)
diff --git a/tests/surface-screenshot.c b/tests/surface-screenshot.c
index 332b5e3..6ff2bfc 100644
--- a/tests/surface-screenshot.c
+++ b/tests/surface-screenshot.c
@@ -34,6 +34,7 @@
 #include <linux/input.h>
 
 #include "compositor.h"
+#include "compositor/weston.h"
 #include "file-util.h"
 
 static char *
diff --git a/tests/surface-test.c b/tests/surface-test.c
index 243f8dc..4463061 100644
--- a/tests/surface-test.c
+++ b/tests/surface-test.c
@@ -29,6 +29,7 @@
 #include <assert.h>
 
 #include "compositor.h"
+#include "compositor/weston.h"
 
 static void
 surface_transform(void *data)
diff --git a/xwayland/launcher.c b/xwayland/launcher.c
index 276795a..0ecdb20 100644
--- a/xwayland/launcher.c
+++ b/xwayland/launcher.c
@@ -351,8 +351,7 @@
 extern const struct weston_xwayland_surface_api surface_api;
 
 WL_EXPORT int
-module_init(struct weston_compositor *compositor,
-	    int *argc, char *argv[])
+weston_module_init(struct weston_compositor *compositor)
 
 {
 	struct wl_display *display = compositor->wl_display;