]> git.ipfire.org Git - thirdparty/haproxy.git/commitdiff
CLEANUP: Add haproxy/xxhash.h to avoid modifying import/xxhash.h
authorTim Duesterhus <tim@bastelstu.be>
Sat, 11 Sep 2021 15:51:13 +0000 (17:51 +0200)
committerWilly Tarreau <w@1wt.eu>
Sat, 11 Sep 2021 17:58:45 +0000 (19:58 +0200)
This solves setting XXH_INLINE_ALL in a cleaner way, because the imported
header is not modified, easing future updates.

see 6f7cc11e6dd0f01b437fba893da2edd2362660a2

12 files changed:
addons/51degrees/51d.c
admin/dyncookie/dyncookie.c
include/haproxy/activity.h
include/haproxy/connection-t.h
include/haproxy/defaults.h
include/haproxy/xxhash.h [new file with mode: 0644]
include/import/xxhash.h
src/pattern.c
src/sample.c
src/server.c
src/server_state.c
src/ssl_sock.c

index 6dfa578e24a7d665ada4581e1cfeaa2b0155fd37..5d686953c90ccb7b17d4f79edecfc3617e7d4095 100644 (file)
@@ -1,7 +1,6 @@
 #include <stdio.h>
 
 #include <import/lru.h>
-#include <import/xxhash.h>
 #include <haproxy/api.h>
 #include <haproxy/arg.h>
 #include <haproxy/buf-t.h>
@@ -15,6 +14,7 @@
 #include <haproxy/sample.h>
 #include <haproxy/thread.h>
 #include <haproxy/tools.h>
+#include <haproxy/xxhash.h>
 #include <51Degrees.h>
 
 struct _51d_property_names {
index 0c778eb7aac63644afc5f5e3c03f061247178ca7..ddb71a748134d1b2bbb3acb13aad177a3c583eef 100644 (file)
@@ -14,7 +14,8 @@
 #include <stdlib.h>
 #include <stdarg.h>
 #include <arpa/inet.h>
-#include <import/xxhash.h>
+
+#include <haproxy/xxhash.h>
 
 __attribute__((noreturn)) void die(int code, const char *format, ...)
 {
index 42569f203e14c158762008383d0a15369dc49973..66a5f3be7ebdc5061c3815d1b8bfc0c0cdc3b4ad 100644 (file)
 #ifndef _HAPROXY_ACTIVITY_H
 #define _HAPROXY_ACTIVITY_H
 
-#include <import/xxhash.h>
 #include <haproxy/activity-t.h>
 #include <haproxy/api.h>
 #include <haproxy/freq_ctr.h>
 #include <haproxy/time.h>
+#include <haproxy/xxhash.h>
 
 extern unsigned int profiling;
 extern unsigned long task_profiling_mask;
index ff8927dbadefeaa9899c7d129d827e5f7b8acff0..1afae9624da68a48a9bc326acf60056f26bda469 100644 (file)
@@ -30,7 +30,6 @@
 
 #include <import/ebmbtree.h>
 #include <import/ist.h>
-#include <import/xxhash.h>
 
 #include <haproxy/api-t.h>
 #include <haproxy/buf-t.h>
@@ -38,6 +37,7 @@
 #include <haproxy/port_range-t.h>
 #include <haproxy/protocol-t.h>
 #include <haproxy/thread-t.h>
+#include <haproxy/xxhash.h>
 
 /* referenced below */
 struct connection;
index 16058817e63cdb0a21318be8efced63d079fdeca..19a9cb62358b45743b67e16c544390ca81c50146 100644 (file)
 #define MAX_POLLERS    10
 #endif
 
-/* Make all xxhash functions inline, with implementations being directly
- * included within xxhash.h.
- */
-#ifndef XXH_INLINE_ALL
-#define XXH_INLINE_ALL
-#endif
-
 /* system sysfs directory */
 #define NUMA_DETECT_SYSTEM_SYSFS_PATH "/sys/devices/system"
 
diff --git a/include/haproxy/xxhash.h b/include/haproxy/xxhash.h
new file mode 100644 (file)
index 0000000..83a2fb7
--- /dev/null
@@ -0,0 +1,45 @@
+/*
+ * Copyright (C) 2020 Dragan Dosen <ddosen@haproxy.com>
+ * Copyright (C) 2021 Tim Duesterhus <tim@bastelstu.be>
+ *
+ * BSD 2-Clause License (https://www.opensource.org/licenses/bsd-license.php)
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are
+ * met:
+ *
+ *    * Redistributions of source code must retain the above copyright
+ *      notice, this list of conditions and the following disclaimer.
+ *    * Redistributions in binary form must reproduce the above
+ *      copyright notice, this list of conditions and the following disclaimer
+ *      in the documentation and/or other materials provided with the
+ *      distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+ * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+ * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+ * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+ * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+ * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+ * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+ * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+ * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#ifndef _HAPROXY_XXHASH_H
+#define _HAPROXY_XXHASH_H
+
+/* Make all xxhash functions inline, with implementations being directly
+ * included within xxhash.h.
+ */
+#ifndef XXH_INLINE_ALL
+#define XXH_INLINE_ALL
+#else
+#error "XXH_INLINE_ALL is already defined."
+#endif
+
+#include <import/xxhash.h>
+
+#endif
index 24326bc33f44cb68012249f7233267aa2b6ca4c3..d0e3e241efb7706b2ae6a54dba8ac838c0f20bb6 100644 (file)
@@ -75,8 +75,6 @@ XXH32        6.8 GB/s            6.0 GB/s
 extern "C" {
 #endif
 
-#include <haproxy/defaults.h>
-
 /* ****************************
  *  INLINE mode
  ******************************/
index afc0ad0d081604a029eb22f89d9a133ab9b43f41..df0f049530b5cc08015ae59110d4e9fddcba0a1e 100644 (file)
@@ -16,7 +16,6 @@
 
 #include <import/ebsttree.h>
 #include <import/lru.h>
-#include <import/xxhash.h>
 
 #include <haproxy/api.h>
 #include <haproxy/global.h>
@@ -26,6 +25,7 @@
 #include <haproxy/regex.h>
 #include <haproxy/sample.h>
 #include <haproxy/tools.h>
+#include <haproxy/xxhash.h>
 
 
 const char *const pat_match_names[PAT_MATCH_NUM] = {
index e4bb3182a6248de1638d8dfa9a04be192b2e7959..3126be1056906f5559cb66651bab50dda4be9d8c 100644 (file)
@@ -18,7 +18,6 @@
 
 #include <import/mjson.h>
 #include <import/sha1.h>
-#include <import/xxhash.h>
 
 #include <haproxy/api.h>
 #include <haproxy/arg.h>
@@ -43,6 +42,7 @@
 #include <haproxy/tools.h>
 #include <haproxy/uri_auth-t.h>
 #include <haproxy/vars.h>
+#include <haproxy/xxhash.h>
 
 /* sample type names */
 const char *smp_to_type[SMP_TYPES] = {
index f0228be810e4a087c7e334760ed7f2d7b1c74688..8f92a252734d2c5774a1e389c304126334d0e08b 100644 (file)
@@ -16,8 +16,6 @@
 #include <ctype.h>
 #include <errno.h>
 
-#include <import/xxhash.h>
-
 #include <haproxy/api.h>
 #include <haproxy/applet-t.h>
 #include <haproxy/backend.h>
@@ -46,6 +44,7 @@
 #include <haproxy/tcpcheck.h>
 #include <haproxy/time.h>
 #include <haproxy/tools.h>
+#include <haproxy/xxhash.h>
 
 
 static void srv_update_status(struct server *s);
index 18d9cd6bfbd80c3c964ffaad4eeb970177313e0b..b9ae9edac693616d6cbde28e282742662de5598a 100644 (file)
@@ -13,7 +13,6 @@
 #include <errno.h>
 
 #include <import/eb64tree.h>
-#include <import/xxhash.h>
 #include <import/ebistree.h>
 
 #include <haproxy/api.h>
@@ -29,6 +28,7 @@
 #include <haproxy/server.h>
 #include <haproxy/ssl_sock.h>
 #include <haproxy/tools.h>
+#include <haproxy/xxhash.h>
 
 
 /* Update a server state using the parameters available in the params list.
index ae30c2cb479bd666dc1bbb60d0516b18e66d8e0a..a87d70b8957fed0f6fda525eaf06ba67349a5e81 100644 (file)
@@ -43,7 +43,6 @@
 #include <import/ebpttree.h>
 #include <import/ebsttree.h>
 #include <import/lru.h>
-#include <import/xxhash.h>
 
 #include <haproxy/api.h>
 #include <haproxy/arg.h>
@@ -79,6 +78,7 @@
 #include <haproxy/tools.h>
 #include <haproxy/vars.h>
 #include <haproxy/xprt_quic.h>
+#include <haproxy/xxhash.h>
 
 
 /* ***** READ THIS before adding code here! *****