]> git.ipfire.org Git - thirdparty/haproxy.git/commitdiff
MINOR: sample: move smp_to_type to sample.c
authorWilly Tarreau <w@1wt.eu>
Fri, 7 Feb 2014 11:14:54 +0000 (12:14 +0100)
committerWilly Tarreau <w@1wt.eu>
Mon, 17 Mar 2014 17:06:06 +0000 (18:06 +0100)
This way it can be exported and reused anywhere else to report type names.

include/proto/sample.h
src/dumpstats.c
src/sample.c

index d363e4ecbd3c239a8551ff9c304f6373b0b173ac..b8a10400f4065160d3da77b9c8af55cf76631d65 100644 (file)
@@ -26,6 +26,8 @@
 #include <types/sample.h>
 #include <types/stick_table.h>
 
+extern const char *smp_to_type[SMP_TYPES];
+
 struct sample_expr *sample_parse_expr(char **str, int *idx, char **err, struct arg_list *al);
 struct sample_conv *find_sample_conv(const char *kw, int len);
 struct sample *sample_process(struct proxy *px, struct session *l4,
index 3835f2c8d73dabf39e9f7ecda7fdfe3acc300fbe..ba0a7a502d26067ef26e82e8b00ed4ea9976f8a2 100644 (file)
@@ -53,6 +53,7 @@
 #include <proto/proto_http.h>
 #include <proto/proto_uxst.h>
 #include <proto/proxy.h>
+#include <proto/sample.h>
 #include <proto/session.h>
 #include <proto/server.h>
 #include <proto/raw_sock.h>
@@ -4836,19 +4837,6 @@ static int stats_maps_list(struct stream_interface *si)
        }
 }
 
-static const char *smp_to_type[SMP_TYPES] = {
-       [SMP_T_BOOL] = "bool",
-       [SMP_T_UINT] = "uint",
-       [SMP_T_SINT] = "sint",
-       [SMP_T_ADDR] = "addr",
-       [SMP_T_IPV4] = "ipv4",
-       [SMP_T_IPV6] = "ipv6",
-       [SMP_T_STR]  = "str",
-       [SMP_T_BIN]  = "bin",
-       [SMP_T_CSTR] = "cstr",
-       [SMP_T_CBIN] = "cbin",
-};
-
 static int stats_map_lookup(struct stream_interface *si)
 {
        struct appctx *appctx = __objt_appctx(si->end);
index 8584dbe8e2a6d1ba0fe094f7671d7ff5edbdb6c8..f57811e5aa64c5d7665bc964c47fe3b0c8e13345 100644 (file)
 #include <proto/sample.h>
 #include <proto/stick_table.h>
 
+/* sample type names */
+const char *smp_to_type[SMP_TYPES] = {
+       [SMP_T_BOOL] = "bool",
+       [SMP_T_UINT] = "uint",
+       [SMP_T_SINT] = "sint",
+       [SMP_T_ADDR] = "addr",
+       [SMP_T_IPV4] = "ipv4",
+       [SMP_T_IPV6] = "ipv6",
+       [SMP_T_STR]  = "str",
+       [SMP_T_BIN]  = "bin",
+       [SMP_T_CSTR] = "cstr",
+       [SMP_T_CBIN] = "cbin",
+};
+
 /* static sample used in sample_process() when <p> is NULL */
 static struct sample temp_smp;