]> git.ipfire.org Git - thirdparty/haproxy.git/commitdiff
MINOR: sample: dont call the sample cast function "c_none"
authorThierry FOURNIER <tfournier@exceliance.fr>
Sat, 14 Dec 2013 13:55:04 +0000 (14:55 +0100)
committerWilly Tarreau <w@1wt.eu>
Mon, 17 Mar 2014 17:06:07 +0000 (18:06 +0100)
If the cast function to execute is c_none, dont execute it and return
true. The function c_none, do nothing. This save a call.

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

index b8a10400f4065160d3da77b9c8af55cf76631d65..db703ef20f3fc9d81963adee7dfb7123821fbb2b 100644 (file)
@@ -42,6 +42,7 @@ const char *sample_ckp_names(unsigned int use);
 struct sample_fetch *find_sample_fetch(const char *kw, int len);
 int smp_resolve_args(struct proxy *p);
 int smp_expr_output_type(struct sample_expr *expr);
+int c_none(struct sample *smp);
 
 /*
  * This function just apply a cast on sample. It returns 0 if the cast is not
@@ -53,6 +54,8 @@ int sample_convert(struct sample *sample, int req_type)
 {
        if (!sample_casts[sample->type][req_type])
                return 0;
+       if (sample_casts[sample->type][req_type] == c_none)
+               return 1;
        return sample_casts[sample->type][req_type](sample);
 }
 
index f57811e5aa64c5d7665bc964c47fe3b0c8e13345..7568d270e6f7d1c5738e4d1916413d898f36e382 100644 (file)
@@ -559,7 +559,7 @@ static int c_bindup(struct sample *smp)
 }
 
 
-static int c_none(struct sample *smp)
+int c_none(struct sample *smp)
 {
        return 1;
 }