]> git.ipfire.org Git - thirdparty/haproxy.git/commitdiff
CLEANUP: tools: do not needlessly include xxhash nor cli from tools.h
authorWilly Tarreau <w@1wt.eu>
Thu, 24 Nov 2022 07:09:12 +0000 (08:09 +0100)
committerWilly Tarreau <w@1wt.eu>
Thu, 24 Nov 2022 07:30:48 +0000 (08:30 +0100)
These includes brought by commit 9c76637ff ("MINOR: anon: add new macros
and functions to anonymize contents") resulted in an increase of exactly
20% of the number of lines to build. These include are not needed there,
only tools.c needs xxhash.h.

include/haproxy/tools.h
src/tools.c

index 3377ed03f04d385535d5ee02643f63f4e6fc315b..c3549918cb8fed7108470eff5e41b48af421c369 100644 (file)
@@ -45,8 +45,6 @@
 #include <haproxy/namespace-t.h>
 #include <haproxy/protocol-t.h>
 #include <haproxy/tools-t.h>
-#include <haproxy/xxhash.h>
-#include <haproxy/cli.h>
 
 /****** string-specific macros and functions ******/
 /* if a > max, then bound <a> to <max>. The macro returns the new <a> */
@@ -57,9 +55,6 @@
 
 #define SWAP(a, b) do { typeof(a) t; t = a; a = b; b = t; } while(0)
 
-/* return the hash of a string and length for a given key. All keys are valid. */
-#define HA_ANON(key, str, len) (XXH32(str, len, key) & 0xFFFFFF)
-
 /* use if you want to return a simple hash. Key 0 doesn't hash. */
 #define HA_ANON_STR(key, str) hash_anon(key, str, "", "")
 
index cfa1cc6aab678445d4315a32816fde3e1130e1c0..a392fe573b78b5c7a66eea704e28496fb2761c11 100644 (file)
@@ -69,6 +69,7 @@ extern void *__elf_aux_vector;
 #include <haproxy/stconn.h>
 #include <haproxy/task.h>
 #include <haproxy/tools.h>
+#include <haproxy/xxhash.h>
 
 /* This macro returns false if the test __x is false. Many
  * of the following parsing function must be abort the processing
@@ -79,6 +80,9 @@ extern void *__elf_aux_vector;
 /* Define the number of line of hash_word */
 #define NB_L_HASH_WORD 15
 
+/* return the hash of a string and length for a given key. All keys are valid. */
+#define HA_ANON(key, str, len) (XXH32(str, len, key) & 0xFFFFFF)
+
 /* enough to store NB_ITOA_STR integers of :
  *   2^64-1 = 18446744073709551615 or
  *    -2^63 = -9223372036854775808