]> granicus.if.org Git - strace/commitdiff
Move MIN, MAX, and CLAMP to macros.h
authorEugene Syromiatnikov <esyr@redhat.com>
Thu, 9 Nov 2017 16:39:18 +0000 (17:39 +0100)
committerDmitry V. Levin <ldv@altlinux.org>
Fri, 10 Nov 2017 17:35:18 +0000 (17:35 +0000)
We shouldn't have to include the whole defs.h to get them.

* defs.h (MIN, MAX, CLAMP): Move ...
* macros.h: ... here.

defs.h
macros.h

diff --git a/defs.h b/defs.h
index 06a4baf64078f81abfbceba248eafc313fd2c2c8..b1a6b95519ab2f70c887a227bafd6d8df4b4180a 100644 (file)
--- a/defs.h
+++ b/defs.h
@@ -75,15 +75,6 @@ const char *strerror(int);
 extern char *stpcpy(char *dst, const char *src);
 #endif
 
-/* macros */
-#ifndef MAX
-# define MAX(a, b)             (((a) > (b)) ? (a) : (b))
-#endif
-#ifndef MIN
-# define MIN(a, b)             (((a) < (b)) ? (a) : (b))
-#endif
-#define CLAMP(val, min, max) MIN(MAX(min, val), max)
-
 /* Glibc has an efficient macro for sigemptyset
  * (it just does one or two assignments of 0 to internal vector of longs).
  */
index a4641349bdb156560bf0f7159ae147cb449a67f5..222a852d71a29a3a81c0ca5a7fb26802a53e9026 100644 (file)
--- a/macros.h
+++ b/macros.h
 #define STRINGIFY(...)         #__VA_ARGS__
 #define STRINGIFY_VAL(...)     STRINGIFY(__VA_ARGS__)
 
+#ifndef MAX
+# define MAX(a, b)             (((a) > (b)) ? (a) : (b))
+#endif
+#ifndef MIN
+# define MIN(a, b)             (((a) < (b)) ? (a) : (b))
+#endif
+#define CLAMP(val, min, max)   MIN(MAX(min, val), max)
+
 #ifndef offsetofend
 # define offsetofend(type_, member_)   \
        (offsetof(type_, member_) + sizeof(((type_ *)0)->member_))