REORG: stick-table: uninline stktable_alloc_data_type()
This function has no business being inlined in stick_table.h since it's
only used at boot time by the config parser. In addition it causes an
undesired dependency on tools.h because it uses parse_time_err(). Let's
move it to stick_table.c.
diff --git a/include/haproxy/stick_table.h b/include/haproxy/stick_table.h
index 5a3b400..d8963b1 100644
--- a/include/haproxy/stick_table.h
+++ b/include/haproxy/stick_table.h
@@ -87,45 +87,7 @@
return 0;
}
-/* reserve some space for data type <type>, and associate argument at <sa> if
- * not NULL. Returns PE_NONE (0) if OK or an error code among :
- * - PE_ENUM_OOR if <type> does not exist
- * - PE_EXIST if <type> is already registered
- * - PE_ARG_NOT_USE if <sa> was provided but not expected
- * - PE_ARG_MISSING if <sa> was expected but not provided
- */
-static inline int stktable_alloc_data_type(struct stktable *t, int type, const char *sa)
-{
- if (type >= STKTABLE_DATA_TYPES)
- return PE_ENUM_OOR;
-
- if (t->data_ofs[type])
- /* already allocated */
- return PE_EXIST;
-
- switch (stktable_data_types[type].arg_type) {
- case ARG_T_NONE:
- if (sa)
- return PE_ARG_NOT_USED;
- break;
- case ARG_T_INT:
- if (!sa)
- return PE_ARG_MISSING;
- t->data_arg[type].i = atoi(sa);
- break;
- case ARG_T_DELAY:
- if (!sa)
- return PE_ARG_MISSING;
- sa = parse_time_err(sa, &t->data_arg[type].u, TIME_UNIT_MS);
- if (sa)
- return PE_ARG_INVC; /* invalid char */
- break;
- }
-
- t->data_size += stktable_type_size(stktable_data_types[type].std_type);
- t->data_ofs[type] = -t->data_size;
- return PE_NONE;
-}
+int stktable_alloc_data_type(struct stktable *t, int type, const char *sa);
/* return pointer for data type <type> in sticky session <ts> of table <t>, all
* of which must exist (otherwise use stktable_data_ptr() if unsure).
diff --git a/src/stick_table.c b/src/stick_table.c
index bb5c0ba..d16e1d0 100644
--- a/src/stick_table.c
+++ b/src/stick_table.c
@@ -707,6 +707,46 @@
return 1;
}
+/* reserve some space for data type <type>, and associate argument at <sa> if
+ * not NULL. Returns PE_NONE (0) if OK or an error code among :
+ * - PE_ENUM_OOR if <type> does not exist
+ * - PE_EXIST if <type> is already registered
+ * - PE_ARG_NOT_USE if <sa> was provided but not expected
+ * - PE_ARG_MISSING if <sa> was expected but not provided
+ */
+int stktable_alloc_data_type(struct stktable *t, int type, const char *sa)
+{
+ if (type >= STKTABLE_DATA_TYPES)
+ return PE_ENUM_OOR;
+
+ if (t->data_ofs[type])
+ /* already allocated */
+ return PE_EXIST;
+
+ switch (stktable_data_types[type].arg_type) {
+ case ARG_T_NONE:
+ if (sa)
+ return PE_ARG_NOT_USED;
+ break;
+ case ARG_T_INT:
+ if (!sa)
+ return PE_ARG_MISSING;
+ t->data_arg[type].i = atoi(sa);
+ break;
+ case ARG_T_DELAY:
+ if (!sa)
+ return PE_ARG_MISSING;
+ sa = parse_time_err(sa, &t->data_arg[type].u, TIME_UNIT_MS);
+ if (sa)
+ return PE_ARG_INVC; /* invalid char */
+ break;
+ }
+
+ t->data_size += stktable_type_size(stktable_data_types[type].std_type);
+ t->data_ofs[type] = -t->data_size;
+ return PE_NONE;
+}
+
/*
* Parse a line with <linenum> as number in <file> configuration file to configure
* the stick-table with <t> as address and <id> as ID.