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>
dev
Jon Cruz 10 years ago committed by Bryce Harrington
parent 35b2eaa989
commit d618f688d5
  1. 2
      clients/nested.c
  2. 2
      clients/weston-info.c
  3. 2
      clients/window.c
  4. 1
      desktop-shell/shell.c
  5. 11
      shared/helpers.h
  6. 4
      src/compositor.h

@ -49,8 +49,6 @@
#include "shared/helpers.h" #include "shared/helpers.h"
#include "window.h" #include "window.h"
#define MIN(x,y) (((x) < (y)) ? (x) : (y))
#ifndef EGL_WL_create_wayland_buffer_from_image #ifndef EGL_WL_create_wayland_buffer_from_image
#define EGL_WL_create_wayland_buffer_from_image 1 #define EGL_WL_create_wayland_buffer_from_image 1

@ -36,8 +36,6 @@
#include "shared/os-compatibility.h" #include "shared/os-compatibility.h"
#include "presentation_timing-client-protocol.h" #include "presentation_timing-client-protocol.h"
#define MIN(x,y) (((x) < (y)) ? (x) : (y))
typedef void (*print_info_t)(void *info); typedef void (*print_info_t)(void *info);
typedef void (*destroy_info_t)(void *info); typedef void (*destroy_info_t)(void *info);

@ -5150,8 +5150,6 @@ fini_xkb(struct input *input)
xkb_keymap_unref(input->xkb.keymap); xkb_keymap_unref(input->xkb.keymap);
} }
#define MIN(a,b) ((a) < (b) ? a : b)
static void static void
display_add_input(struct display *d, uint32_t id) display_add_input(struct display *d, uint32_t id)
{ {

@ -39,6 +39,7 @@
#include "desktop-shell-server-protocol.h" #include "desktop-shell-server-protocol.h"
#include "workspaces-server-protocol.h" #include "workspaces-server-protocol.h"
#include "shared/config-parser.h" #include "shared/config-parser.h"
#include "shared/helpers.h"
#include "xdg-shell-server-protocol.h" #include "xdg-shell-server-protocol.h"
#define DEFAULT_NUM_WORKSPACES 1 #define DEFAULT_NUM_WORKSPACES 1

@ -41,6 +41,17 @@ extern "C" {
#define ARRAY_LENGTH(a) (sizeof (a) / sizeof (a)[0]) #define ARRAY_LENGTH(a) (sizeof (a) / sizeof (a)[0])
#endif #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 #ifdef __cplusplus
} }
#endif #endif

@ -45,10 +45,6 @@ extern "C" {
#include "zalloc.h" #include "zalloc.h"
#include "timeline-object.h" #include "timeline-object.h"
#ifndef MIN
#define MIN(x,y) (((x) < (y)) ? (x) : (y))
#endif
#define container_of(ptr, type, member) ({ \ #define container_of(ptr, type, member) ({ \
const __typeof__( ((type *)0)->member ) *__mptr = (ptr); \ const __typeof__( ((type *)0)->member ) *__mptr = (ptr); \
(type *)( (char *)__mptr - offsetof(type,member) );}) (type *)( (char *)__mptr - offsetof(type,member) );})

Loading…
Cancel
Save