From: Eugene Syromiatnikov <esyr@redhat.com>
Date: Thu, 9 Nov 2017 16:39:18 +0000 (+0100)
Subject: Move MIN, MAX, and CLAMP to macros.h
X-Git-Tag: v4.20~14
X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=bb9673ba1dc3888c0608c3c4dcc98b83cf1f0a05;p=strace

Move MIN, MAX, and CLAMP to macros.h

We shouldn't have to include the whole defs.h to get them.

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

diff --git a/defs.h b/defs.h
index 06a4baf6..b1a6b955 100644
--- 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).
  */
diff --git a/macros.h b/macros.h
index a4641349..222a852d 100644
--- a/macros.h
+++ b/macros.h
@@ -35,6 +35,14 @@
 #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_))