From 34122f9f064bff220e066a036315daa0778cfd54 Mon Sep 17 00:00:00 2001 From: Ran Benita Date: Fri, 27 Dec 2019 12:34:49 +0200 Subject: utils: use MIN/MAX instead of min/max min/max symbols conflict on some systems (msvc), so just use the macros. Signed-off-by: Ran Benita --- src/utils.h | 14 -------------- src/x11/util.c | 2 +- src/xkbcomp/keymap-dump.c | 4 ++-- 3 files changed, 3 insertions(+), 17 deletions(-) diff --git a/src/utils.h b/src/utils.h index ebf3601..c012651 100644 --- a/src/utils.h +++ b/src/utils.h @@ -110,18 +110,6 @@ memdup(const void *mem, size_t nmemb, size_t size) return p; } -static inline int -min(int misc, int other) -{ - return (misc < other) ? misc : other; -} - -static inline int -max(int misc, int other) -{ - return (misc > other) ? misc : other; -} - /* ctype.h is locale-dependent and has other oddities. */ static inline bool is_space(char ch) @@ -194,9 +182,7 @@ unmap_file(char *string, size_t size); #define ARRAY_SIZE(arr) ((sizeof(arr) / sizeof(*(arr)))) #define MIN(a, b) ((a) < (b) ? (a) : (b)) -#define MIN3(a, b, c) MIN(MIN((a), (b)), (c)) #define MAX(a, b) ((a) > (b) ? (a) : (b)) -#define MAX3(a, b, c) MAX(MAX((a), (b)), (c)) /* Round up @a so it's divisible by @b. */ #define ROUNDUP(a, b) (((a) + (b) - 1) / (b) * (b)) diff --git a/src/x11/util.c b/src/x11/util.c index c41f1d6..b709bf2 100644 --- a/src/x11/util.c +++ b/src/x11/util.c @@ -164,7 +164,7 @@ adopt_atoms(struct xkb_context *ctx, xcb_connection_t *conn, /* Send and collect the atoms in batches of reasonable SIZE. */ for (size_t batch = 0; batch < num_batches; batch++) { const size_t start = batch * SIZE; - const size_t stop = min((batch + 1) * SIZE, count); + const size_t stop = MIN((batch + 1) * SIZE, count); /* Send. */ for (size_t i = start; i < stop; i++) diff --git a/src/xkbcomp/keymap-dump.c b/src/xkbcomp/keymap-dump.c index 5aea4b5..615d49e 100644 --- a/src/xkbcomp/keymap-dump.c +++ b/src/xkbcomp/keymap-dump.c @@ -161,8 +161,8 @@ write_keycodes(struct xkb_keymap *keymap, struct buf *buf) * a maximum of at least 255, else XWayland really starts hating life. * If this is a problem and people really need strictly bounded keymaps, * we should probably control this with a flag. */ - write_buf(buf, "\tminimum = %u;\n", min(keymap->min_key_code, 8)); - write_buf(buf, "\tmaximum = %u;\n", max(keymap->max_key_code, 255)); + write_buf(buf, "\tminimum = %u;\n", MIN(keymap->min_key_code, 8)); + write_buf(buf, "\tmaximum = %u;\n", MAX(keymap->max_key_code, 255)); xkb_keys_foreach(key, keymap) { if (key->name == XKB_ATOM_NONE) -- cgit v1.2.3