]> git.ipfire.org Git - thirdparty/haproxy.git/commitdiff
REORG: compat: move some integer limit definitions from standard.h to compat.h
authorWilly Tarreau <w@1wt.eu>
Mon, 20 May 2019 17:10:52 +0000 (19:10 +0200)
committerWilly Tarreau <w@1wt.eu>
Mon, 20 May 2019 17:59:34 +0000 (19:59 +0200)
Historically standard.h was the location where we used to (re-)define the
standard set of macros and functions, and to complement the ones missing
on the target OS. Over time it has become a toolbox in itself relying on
many other things, and its definition of LONGBITS is used everywhere else
(e.g. for MAX_THREADS), resulting in painful circular dependencies.

Let's move these few defines (integer sizes) to compat.h where other
similar definitions normally are.

include/common/compat.h
include/common/standard.h

index 1401f91d4c8a8d520851c7adf00a53a0b2318a4e..34d1b35c591097a21423076269074d41ec2f3d7c 100644 (file)
 #include <netinet/in.h>
 #include <netinet/tcp.h>
 
+// Redefine some limits that are not present everywhere
+#ifndef LLONG_MAX
+# define LLONG_MAX 9223372036854775807LL
+# define LLONG_MIN (-LLONG_MAX - 1LL)
+#endif
+
+#ifndef ULLONG_MAX
+# define ULLONG_MAX    (LLONG_MAX * 2ULL + 1)
+#endif
+
+#ifndef LONGBITS
+#define LONGBITS  ((unsigned int)sizeof(long) * 8)
+#endif
+
 #ifndef BITS_PER_INT
 #define BITS_PER_INT    (8*sizeof(int))
 #endif
index 0bea022b91074e657c108e709895ba6078844a48..e88a79ddf440fb0c5f030338ce1696e98eeaed58 100644 (file)
 #include <eb32sctree.h>
 #include <types/protocol.h>
 
-#ifndef LLONG_MAX
-# define LLONG_MAX 9223372036854775807LL
-# define LLONG_MIN (-LLONG_MAX - 1LL)
-#endif
-
-#ifndef ULLONG_MAX
-# define ULLONG_MAX    (LLONG_MAX * 2ULL + 1)
-#endif
-
-#ifndef LONGBITS
-#define LONGBITS  ((unsigned int)sizeof(long) * 8)
-#endif
-
 /* size used for max length of decimal representation of long long int. */
 #define NB_LLMAX_STR (sizeof("-9223372036854775807")-1)