MINOR: http-conv: Don't check if argument list is set in sample converters

The list is always defined by definition. Thus there is no reason to test
it.
This commit is contained in:
Christopher Faulet 2021-01-29 11:25:02 +01:00
parent 623af93722
commit 72dbcfe66d

View File

@ -49,16 +49,16 @@ static int sample_conv_http_date(const struct arg *args, struct sample *smp, voi
time_t curr_date; time_t curr_date;
/* add offset */ /* add offset */
if (args && (args[0].type == ARGT_SINT)) if (args[0].type == ARGT_SINT)
smp->data.u.sint += args[0].data.sint; smp->data.u.sint += args[0].data.sint;
/* report in milliseconds */ /* report in milliseconds */
if (args && args[1].type == ARGT_SINT && args[1].data.sint == TIME_UNIT_MS) { if (args[1].type == ARGT_SINT && args[1].data.sint == TIME_UNIT_MS) {
sec_frac = smp->data.u.sint % 1000; sec_frac = smp->data.u.sint % 1000;
smp->data.u.sint /= 1000; smp->data.u.sint /= 1000;
} }
/* report in microseconds */ /* report in microseconds */
else if (args && args[1].type == ARGT_SINT && args[1].data.sint == TIME_UNIT_US) { else if (args[1].type == ARGT_SINT && args[1].data.sint == TIME_UNIT_US) {
sec_frac = smp->data.u.sint % 1000000; sec_frac = smp->data.u.sint % 1000000;
smp->data.u.sint /= 1000000; smp->data.u.sint /= 1000000;
} }
@ -71,7 +71,7 @@ static int sample_conv_http_date(const struct arg *args, struct sample *smp, voi
return 0; return 0;
temp = get_trash_chunk(); temp = get_trash_chunk();
if (args && args[1].type == ARGT_SINT && args[1].data.sint != TIME_UNIT_S) { if (args[1].type == ARGT_SINT && args[1].data.sint != TIME_UNIT_S) {
temp->data = snprintf(temp->area, temp->size - temp->data, temp->data = snprintf(temp->area, temp->size - temp->data,
"%s, %02d %s %04d %02d:%02d:%02d.%d GMT", "%s, %02d %s %04d %02d:%02d:%02d.%d GMT",
day[tm->tm_wday], tm->tm_mday, mon[tm->tm_mon], day[tm->tm_wday], tm->tm_mday, mon[tm->tm_mon],
@ -258,7 +258,7 @@ static int sample_conv_url_dec(const struct arg *args, struct sample *smp, void
/* Add final \0 required by url_decode(), and convert the input string. */ /* Add final \0 required by url_decode(), and convert the input string. */
smp->data.u.str.area[smp->data.u.str.data] = '\0'; smp->data.u.str.area[smp->data.u.str.data] = '\0';
if (args && (args[0].type == ARGT_SINT)) if (args[0].type == ARGT_SINT)
in_form = !!args[0].data.sint; in_form = !!args[0].data.sint;
len = url_decode(smp->data.u.str.area, in_form); len = url_decode(smp->data.u.str.area, in_form);
@ -324,7 +324,6 @@ static int sample_conv_url_enc(const struct arg *args, struct sample *smp, void
char *ret; char *ret;
enc_type = ENC_QUERY; enc_type = ENC_QUERY;
if (args)
enc_type = args->data.sint; enc_type = args->data.sint;
/* Add final \0 required by encode_string() */ /* Add final \0 required by encode_string() */
@ -351,7 +350,7 @@ static int smp_conv_req_capture(const struct arg *args, struct sample *smp, void
struct cap_hdr *hdr; struct cap_hdr *hdr;
int len; int len;
if (!args || args->type != ARGT_SINT) if (args->type != ARGT_SINT)
return 0; return 0;
if (!smp->strm) if (!smp->strm)
@ -396,7 +395,7 @@ static int smp_conv_res_capture(const struct arg *args, struct sample *smp, void
struct cap_hdr *hdr; struct cap_hdr *hdr;
int len; int len;
if (!args || args->type != ARGT_SINT) if (args->type != ARGT_SINT)
return 0; return 0;
if (!smp->strm) if (!smp->strm)