diff options
author | Jon Cruz <jonc@osg.samsung.com> | 2015-06-15 15:37:09 -0700 |
---|---|---|
committer | Bryce Harrington <bryce@osg.samsung.com> | 2015-06-15 17:11:52 -0700 |
commit | d618f688d53e1df0ac31a275ae8541dc56f283ed (patch) | |
tree | 2491eabcb4e57b4a3e9604b2b09458f36e2255f8 | |
parent | 35b2eaa989e4960501943c0753e2d5a3e687db92 (diff) |
Moved the MIN() macro to the helper include.
Removed multiple definitions of the MIN() macro from existing
locations and unified with a single definition. Updated sources
to use the shared version.
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>
-rw-r--r-- | clients/nested.c | 2 | ||||
-rw-r--r-- | clients/weston-info.c | 2 | ||||
-rw-r--r-- | clients/window.c | 2 | ||||
-rw-r--r-- | desktop-shell/shell.c | 1 | ||||
-rw-r--r-- | shared/helpers.h | 11 | ||||
-rw-r--r-- | src/compositor.h | 4 |
6 files changed, 12 insertions, 10 deletions
diff --git a/clients/nested.c b/clients/nested.c index f758fdc2..e78f08c3 100644 --- a/clients/nested.c +++ b/clients/nested.c @@ -49,8 +49,6 @@ #include "shared/helpers.h" #include "window.h" -#define MIN(x,y) (((x) < (y)) ? (x) : (y)) - #ifndef EGL_WL_create_wayland_buffer_from_image #define EGL_WL_create_wayland_buffer_from_image 1 diff --git a/clients/weston-info.c b/clients/weston-info.c index 58e8e833..89ef8f18 100644 --- a/clients/weston-info.c +++ b/clients/weston-info.c @@ -36,8 +36,6 @@ #include "shared/os-compatibility.h" #include "presentation_timing-client-protocol.h" -#define MIN(x,y) (((x) < (y)) ? (x) : (y)) - typedef void (*print_info_t)(void *info); typedef void (*destroy_info_t)(void *info); diff --git a/clients/window.c b/clients/window.c index c5e6f5af..ff4be8c8 100644 --- a/clients/window.c +++ b/clients/window.c @@ -5150,8 +5150,6 @@ fini_xkb(struct input *input) xkb_keymap_unref(input->xkb.keymap); } -#define MIN(a,b) ((a) < (b) ? a : b) - static void display_add_input(struct display *d, uint32_t id) { diff --git a/desktop-shell/shell.c b/desktop-shell/shell.c index 37936140..a60a3aa4 100644 --- a/desktop-shell/shell.c +++ b/desktop-shell/shell.c @@ -39,6 +39,7 @@ #include "desktop-shell-server-protocol.h" #include "workspaces-server-protocol.h" #include "shared/config-parser.h" +#include "shared/helpers.h" #include "xdg-shell-server-protocol.h" #define DEFAULT_NUM_WORKSPACES 1 diff --git a/shared/helpers.h b/shared/helpers.h index 7502ff32..83f79b11 100644 --- a/shared/helpers.h +++ b/shared/helpers.h @@ -41,6 +41,17 @@ extern "C" { #define ARRAY_LENGTH(a) (sizeof (a) / sizeof (a)[0]) #endif +/** + * Returns the smaller of two values. + * + * @param x the first item to compare. + * @param y the second item to compare. + * @return the value that evaluates to lesser than the other. + */ +#ifndef MIN +#define MIN(x,y) (((x) < (y)) ? (x) : (y)) +#endif + #ifdef __cplusplus } #endif diff --git a/src/compositor.h b/src/compositor.h index 685767e3..b7b2d220 100644 --- a/src/compositor.h +++ b/src/compositor.h @@ -45,10 +45,6 @@ extern "C" { #include "zalloc.h" #include "timeline-object.h" -#ifndef MIN -#define MIN(x,y) (((x) < (y)) ? (x) : (y)) -#endif - #define container_of(ptr, type, member) ({ \ const __typeof__( ((type *)0)->member ) *__mptr = (ptr); \ (type *)( (char *)__mptr - offsetof(type,member) );}) |