]> git.ipfire.org Git - thirdparty/tor.git/commitdiff
Move MIN and MAX into lib/intmath/cmp.h
authorNick Mathewson <nickm@torproject.org>
Thu, 28 Jun 2018 17:19:42 +0000 (13:19 -0400)
committerNick Mathewson <nickm@torproject.org>
Thu, 28 Jun 2018 17:19:42 +0000 (13:19 -0400)
src/common/compat.h
src/lib/intmath/cmp.h

index 43e98d906cbd139afdd042b016088f4dbbd9e1a7..ec4df1cc5581c09c5cafd6bb3ad54269d3f5b432 100644 (file)
@@ -60,6 +60,7 @@
 #include "lib/fs/mmap.h"
 #include "lib/fs/userdb.h"
 #include "lib/wallclock/timeval.h"
+#include "lib/intmath/cmp.h"
 
 #include <stdio.h>
 #include <errno.h>
@@ -92,19 +93,6 @@ typedef unsigned long rlim_t;
 int set_max_file_descriptors(rlim_t limit, int *max);
 MOCK_DECL(int, get_total_system_memory, (size_t *mem_out));
 
-/** Macros for MIN/MAX.  Never use these when the arguments could have
- * side-effects.
- * {With GCC extensions we could probably define a safer MIN/MAX.  But
- * depending on that safety would be dangerous, since not every platform
- * has it.}
- **/
-#ifndef MAX
-#define MAX(a,b) ( ((a)<(b)) ? (b) : (a) )
-#endif
-#ifndef MIN
-#define MIN(a,b) ( ((a)>(b)) ? (b) : (a) )
-#endif
-
 ssize_t tor_getpass(const char *prompt, char *output, size_t buflen);
 
 /* This needs some of the declarations above so we include it here. */
index 90ea3ca079fa46dccd6481c9556b1d54d5b2db77..627e5d18b436c9490af7349dd4e9ba1056853d11 100644 (file)
@@ -6,6 +6,19 @@
 #ifndef TOR_INTMATH_CMP_H
 #define TOR_INTMATH_CMP_H
 
+/** Macros for MIN/MAX.  Never use these when the arguments could have
+ * side-effects.
+ * {With GCC extensions we could probably define a safer MIN/MAX.  But
+ * depending on that safety would be dangerous, since not every platform
+ * has it.}
+ **/
+#ifndef MAX
+#define MAX(a,b) ( ((a)<(b)) ? (b) : (a) )
+#endif
+#ifndef MIN
+#define MIN(a,b) ( ((a)>(b)) ? (b) : (a) )
+#endif
+
 /* Return <b>v</b> if it's between <b>min</b> and <b>max</b>.  Otherwise
  * return <b>min</b> if <b>v</b> is smaller than <b>min</b>, or <b>max</b> if
  * <b>b</b> is larger than <b>max</b>.