CLEANUP: Reapply strcmp.cocci (3)

This reapplies strcmp.cocci across the whole src/ tree.
This commit is contained in:
Tim Duesterhus 2026-04-28 21:59:13 +02:00 committed by Willy Tarreau
parent 0a1d9e4551
commit 0bf844aaca
6 changed files with 17 additions and 17 deletions

View File

@ -1003,9 +1003,9 @@ static int ssl_bind_parse_ktls(char **args, int cur_arg, struct proxy *px, struc
memprintf(err, "'%s' directive is experimental, must be allowed via a global 'expose-experimental-directives'", args[cur_arg]);
return ERR_ALERT | ERR_FATAL;
}
if (!strcasecmp(args[cur_arg + 1], "on")) {
if (strcasecmp(args[cur_arg + 1], "on") == 0) {
conf->ktls = 1;
} else if (!strcasecmp(args[cur_arg + 1], "off")) {
} else if (strcasecmp(args[cur_arg + 1], "off") == 0) {
conf->ktls = 0;
} else {
memprintf(err, "'%s' expects \"on\" or \"off\" as an argument, got '%s'.",
@ -2081,9 +2081,9 @@ static int srv_parse_ktls(char **args, int *cur_arg, struct proxy *px, struct se
return ERR_ALERT | ERR_FATAL;
}
if (!strcasecmp(args[*cur_arg + 1], "on")) {
if (strcasecmp(args[*cur_arg + 1], "on") == 0) {
newsrv->ssl_ctx.options |= SRV_SSL_O_KTLS;
} else if (!strcasecmp(args[*cur_arg + 1], "off")) {
} else if (strcasecmp(args[*cur_arg + 1], "off") == 0) {
newsrv->ssl_ctx.options &= ~SRV_SSL_O_KTLS;
} else {
memprintf(err, "'%s' expects \"on\" or \"off\" as an argument, got '%s'.",

View File

@ -633,9 +633,9 @@ static int cli_parse_global(char **args, int section_type, struct proxy *curpx,
global.cli_fe->maxconn = maxconn;
}
else if (strcmp(args[1], "calculate-max-counters") == 0) {
if (!strcasecmp(args[2], "on"))
if (strcasecmp(args[2], "on") == 0)
return 0;
else if (!strcasecmp(args[2], "off")) {
else if (strcasecmp(args[2], "off") == 0) {
global.tune.options |= GTUNE_NO_MAX_COUNTER;
return 0;
}

View File

@ -2164,14 +2164,14 @@ static int cfg_parse_cpu_affinity(char **args, int section_type, struct proxy *c
return -1;
for (i = 0; ha_cpu_affinity[i].name != NULL; i++) {
if (!strcmp(args[1], ha_cpu_affinity[i].name)) {
if (strcmp(args[1], ha_cpu_affinity[i].name) == 0) {
cpu_policy_conf.affinity |= ha_cpu_affinity[i].affinity_flags;
if (*args[2] != 0) {
struct cpu_affinity_optional *optional = ha_cpu_affinity[i].optional;
if (optional) {
for (i = 0; optional[i].name; i++) {
if (!strcmp(args[2], optional[i].name)) {
if (strcmp(args[2], optional[i].name) == 0) {
cpu_policy_conf.affinity |= optional[i].affinity_flag;
return 0;
}
@ -2334,10 +2334,10 @@ static int cfg_parse_cpu_policy(char **args, int section_type, struct proxy *cur
return -1;
if (*args[2] != 0) {
if (!strcmp(args[2], "threads-per-core")) {
if (!strcmp(args[3], "1"))
if (strcmp(args[2], "threads-per-core") == 0) {
if (strcmp(args[3], "1") == 0)
cpu_policy_conf.flags |= CPU_POLICY_ONE_THREAD_PER_CORE;
else if (strcmp(args[3], "auto")) {
else if (strcmp(args[3], "auto") != 0) {
memprintf(err, "'%s' passed an unknown value '%s' to keyword '%s', known values are 1 or auto", args[0], args[3], args[2]);
return -1;
}

View File

@ -322,9 +322,9 @@ parse_filter_sequence(char **args, int section_type, struct proxy *curpx,
goto error;
}
if (!strcmp(args[1], "request"))
if (strcmp(args[1], "request") == 0)
list = &curpx->filter_sequence.req;
else if (!strcmp(args[1], "response"))
else if (strcmp(args[1], "response") == 0)
list = &curpx->filter_sequence.res;
else {
memprintf(err,
@ -379,7 +379,7 @@ static int compile_filter_sequence_elt(struct proxy *px, struct filter_sequence_
int ret = ERR_NONE;
list_for_each_entry(fconf, &px->filter_configs, list) {
if (!strcmp(elt->flt_name, fconf->name)) {
if (strcmp(elt->flt_name, fconf->name) == 0) {
elt->flt_conf = fconf;
break;
}

View File

@ -7041,7 +7041,7 @@ enum act_parse_ret do_log_parse_act(enum log_orig_id id,
rule->arg.do_log.orig = id;
while (*args[*orig_arg]) {
if (!strcmp(args[*orig_arg], "profile")) {
if (strcmp(args[*orig_arg], "profile") == 0) {
if (!*args[*orig_arg + 1]) {
memprintf(err,
"action '%s': 'profile' expects argument.",

View File

@ -4821,9 +4821,9 @@ static int ckch_conf_load_pem_or_generate(void *value, char *buf, struct ckch_st
if (!s->conf.gencrt.key.type)
type = EVP_PKEY_RSA;
else {
if (!strcmp(s->conf.gencrt.key.type, "RSA"))
if (strcmp(s->conf.gencrt.key.type, "RSA") == 0)
type = EVP_PKEY_RSA;
else if (!strcmp(s->conf.gencrt.key.type, "ECDSA"))
else if (strcmp(s->conf.gencrt.key.type, "ECDSA") == 0)
type = EVP_PKEY_EC;
else {
memprintf(err, "keyword 'keytype' requires either 'RSA' or 'ECDSA'.");