Unified multiple definitions of container_of() macro.

Removed duplicate definitions of the container_of() macro and
refactored sources to use the single implementation.

Signed-off-by: Jon A. Cruz <jonc@osg.samsung.com>
Reviewed-by: Peter Hutterer <peter.hutterer@who-t.net>
Reviewed-by: Bryce Harrington <bryce@osg.samsung.com>
diff --git a/src/animation.c b/src/animation.c
index 4b69bdd..cc7482d 100644
--- a/src/animation.c
+++ b/src/animation.c
@@ -34,6 +34,7 @@
 #include <fcntl.h>
 
 #include "compositor.h"
+#include "shared/helpers.h"
 
 WL_EXPORT void
 weston_spring_init(struct weston_spring *spring,
diff --git a/src/bindings.c b/src/bindings.c
index 5aa8b6e..e339454 100644
--- a/src/bindings.c
+++ b/src/bindings.c
@@ -29,6 +29,7 @@
 #include <linux/input.h>
 
 #include "compositor.h"
+#include "shared/helpers.h"
 
 struct weston_binding {
 	uint32_t key;
diff --git a/src/clipboard.c b/src/clipboard.c
index 023cd41..da7dbb6 100644
--- a/src/clipboard.c
+++ b/src/clipboard.c
@@ -33,6 +33,7 @@
 #include <sys/uio.h>
 
 #include "compositor.h"
+#include "shared/helpers.h"
 
 struct clipboard_source {
 	struct weston_data_source base;
diff --git a/src/cms-colord.c b/src/cms-colord.c
index b318e4b..2adc886 100644
--- a/src/cms-colord.c
+++ b/src/cms-colord.c
@@ -36,6 +36,7 @@
 
 #include "compositor.h"
 #include "cms-helper.h"
+#include "shared/helpers.h"
 
 struct cms_colord {
 	struct weston_compositor	*ec;
diff --git a/src/cms-static.c b/src/cms-static.c
index 2a3ca75..7166f57 100644
--- a/src/cms-static.c
+++ b/src/cms-static.c
@@ -30,6 +30,7 @@
 
 #include "compositor.h"
 #include "cms-helper.h"
+#include "shared/helpers.h"
 
 struct cms_static {
 	struct weston_compositor	*ec;
diff --git a/src/compositor.h b/src/compositor.h
index b7b2d22..3586f5b 100644
--- a/src/compositor.h
+++ b/src/compositor.h
@@ -45,10 +45,6 @@
 #include "zalloc.h"
 #include "timeline-object.h"
 
-#define container_of(ptr, type, member) ({				\
-	const __typeof__( ((type *)0)->member ) *__mptr = (ptr);	\
-	(type *)( (char *)__mptr - offsetof(type,member) );})
-
 struct weston_transform {
 	struct weston_matrix matrix;
 	struct wl_list link;
diff --git a/src/data-device.c b/src/data-device.c
index 8cdf223..825b734 100644
--- a/src/data-device.c
+++ b/src/data-device.c
@@ -32,6 +32,7 @@
 #include <assert.h>
 
 #include "compositor.h"
+#include "shared/helpers.h"
 
 struct weston_drag {
 	struct wl_client *client;
diff --git a/src/libinput-device.c b/src/libinput-device.c
index 9fba25e..2cbfb88 100644
--- a/src/libinput-device.c
+++ b/src/libinput-device.c
@@ -38,6 +38,7 @@
 
 #include "compositor.h"
 #include "libinput-device.h"
+#include "shared/helpers.h"
 
 #define DEFAULT_AXIS_STEP_DISTANCE wl_fixed_from_int(10)
 
diff --git a/src/libinput-seat.c b/src/libinput-seat.c
index 7757170..ce79d34 100644
--- a/src/libinput-seat.c
+++ b/src/libinput-seat.c
@@ -37,6 +37,7 @@
 #include "launcher-util.h"
 #include "libinput-seat.h"
 #include "libinput-device.h"
+#include "shared/helpers.h"
 
 static const char default_seat[] = "seat0";
 static const char default_seat_name[] = "default";
diff --git a/src/pixman-renderer.c b/src/pixman-renderer.c
index 23315b1..b19875d 100644
--- a/src/pixman-renderer.c
+++ b/src/pixman-renderer.c
@@ -32,6 +32,7 @@
 #include <assert.h>
 
 #include "pixman-renderer.h"
+#include "shared/helpers.h"
 
 #include <linux/input.h>
 
diff --git a/src/rpi-renderer.c b/src/rpi-renderer.c
index d218532..204802e 100644
--- a/src/rpi-renderer.c
+++ b/src/rpi-renderer.c
@@ -37,6 +37,7 @@
 
 #include "compositor.h"
 #include "rpi-renderer.h"
+#include "shared/helpers.h"
 
 #ifdef ENABLE_EGL
 #include <EGL/egl.h>
diff --git a/src/screen-share.c b/src/screen-share.c
index 92c4e02..6b1b34c 100644
--- a/src/screen-share.c
+++ b/src/screen-share.c
@@ -40,6 +40,7 @@
 #include <wayland-client.h>
 
 #include "compositor.h"
+#include "shared/helpers.h"
 #include "shared/os-compatibility.h"
 #include "fullscreen-shell-client-protocol.h"
 
diff --git a/src/screenshooter.c b/src/screenshooter.c
index ecf2fdd..b7b8dce 100644
--- a/src/screenshooter.c
+++ b/src/screenshooter.c
@@ -35,6 +35,7 @@
 
 #include "compositor.h"
 #include "screenshooter-server-protocol.h"
+#include "shared/helpers.h"
 
 #include "wcap/wcap-decode.h"
 
diff --git a/src/text-backend.c b/src/text-backend.c
index 4ebbbdd..d33f703 100644
--- a/src/text-backend.c
+++ b/src/text-backend.c
@@ -35,6 +35,7 @@
 #include "compositor.h"
 #include "text-server-protocol.h"
 #include "input-method-server-protocol.h"
+#include "shared/helpers.h"
 
 struct text_input_manager;
 struct input_method;
diff --git a/src/zoom.c b/src/zoom.c
index 880df68..4216607 100644
--- a/src/zoom.c
+++ b/src/zoom.c
@@ -29,6 +29,7 @@
 
 #include "compositor.h"
 #include "text-cursor-position-server-protocol.h"
+#include "shared/helpers.h"
 
 static void
 weston_zoom_frame_z(struct weston_animation *animation,