CLEANUP: sample: rename sample_conv_var2smp() to *_sint
This one only handles integers, contrary to its sibling with the suffix
_str that only handles strings. Let's rename it and uninline it since it
may well be used from outside.
(cherry picked from commit d9be59952975e679f3305e32620ae3572a6a952c)
Signed-off-by: Christopher Faulet <cfaulet@haproxy.com>
diff --git a/include/haproxy/sample.h b/include/haproxy/sample.h
index aac6efa..e1d0a86 100644
--- a/include/haproxy/sample.h
+++ b/include/haproxy/sample.h
@@ -40,6 +40,7 @@
struct sample *sample_fetch_as_type(struct proxy *px, struct session *sess,
struct stream *strm, unsigned int opt,
struct sample_expr *expr, int smp_type);
+int sample_conv_var2smp_sint(const struct arg *arg, struct sample *smp);
void release_sample_expr(struct sample_expr *expr);
void sample_register_fetches(struct sample_fetch_kw_list *psl);
void sample_register_convs(struct sample_conv_kw_list *psl);
diff --git a/src/sample.c b/src/sample.c
index c010580..bf97579 100644
--- a/src/sample.c
+++ b/src/sample.c
@@ -2869,7 +2869,7 @@
*
* This function returns 0 if an error occurs, otherwise it returns 1.
*/
-static inline int sample_conv_var2smp(const struct arg *arg, struct sample *smp)
+int sample_conv_var2smp_sint(const struct arg *arg, struct sample *smp)
{
switch (arg->type) {
case ARGT_SINT:
@@ -2906,7 +2906,7 @@
struct sample tmp;
smp_set_owner(&tmp, smp->px, smp->sess, smp->strm, smp->opt);
- if (!sample_conv_var2smp(arg_p, &tmp))
+ if (!sample_conv_var2smp_sint(arg_p, &tmp))
return 0;
smp->data.u.sint &= tmp.data.u.sint;
return 1;
@@ -2920,7 +2920,7 @@
struct sample tmp;
smp_set_owner(&tmp, smp->px, smp->sess, smp->strm, smp->opt);
- if (!sample_conv_var2smp(arg_p, &tmp))
+ if (!sample_conv_var2smp_sint(arg_p, &tmp))
return 0;
smp->data.u.sint |= tmp.data.u.sint;
return 1;
@@ -2934,7 +2934,7 @@
struct sample tmp;
smp_set_owner(&tmp, smp->px, smp->sess, smp->strm, smp->opt);
- if (!sample_conv_var2smp(arg_p, &tmp))
+ if (!sample_conv_var2smp_sint(arg_p, &tmp))
return 0;
smp->data.u.sint ^= tmp.data.u.sint;
return 1;
@@ -2974,7 +2974,7 @@
struct sample tmp;
smp_set_owner(&tmp, smp->px, smp->sess, smp->strm, smp->opt);
- if (!sample_conv_var2smp(arg_p, &tmp))
+ if (!sample_conv_var2smp_sint(arg_p, &tmp))
return 0;
smp->data.u.sint = arith_add(smp->data.u.sint, tmp.data.u.sint);
return 1;
@@ -2989,7 +2989,7 @@
struct sample tmp;
smp_set_owner(&tmp, smp->px, smp->sess, smp->strm, smp->opt);
- if (!sample_conv_var2smp(arg_p, &tmp))
+ if (!sample_conv_var2smp_sint(arg_p, &tmp))
return 0;
/* We cannot represent -LLONG_MIN because abs(LLONG_MIN) is greater
@@ -3022,7 +3022,7 @@
long long int c;
smp_set_owner(&tmp, smp->px, smp->sess, smp->strm, smp->opt);
- if (!sample_conv_var2smp(arg_p, &tmp))
+ if (!sample_conv_var2smp_sint(arg_p, &tmp))
return 0;
/* prevent divide by 0 during the check */
@@ -3066,7 +3066,7 @@
struct sample tmp;
smp_set_owner(&tmp, smp->px, smp->sess, smp->strm, smp->opt);
- if (!sample_conv_var2smp(arg_p, &tmp))
+ if (!sample_conv_var2smp_sint(arg_p, &tmp))
return 0;
if (tmp.data.u.sint) {
@@ -3094,7 +3094,7 @@
struct sample tmp;
smp_set_owner(&tmp, smp->px, smp->sess, smp->strm, smp->opt);
- if (!sample_conv_var2smp(arg_p, &tmp))
+ if (!sample_conv_var2smp_sint(arg_p, &tmp))
return 0;
if (tmp.data.u.sint) {