From: Tim Duesterhus Date: Tue, 28 Apr 2026 19:59:13 +0000 (+0200) Subject: CLEANUP: Reapply strcmp.cocci (3) X-Git-Url: http://git.ipfire.org/gitweb/?a=commitdiff_plain;h=0bf844aacafe29c1deaaad9fa957cefac671d0b0;p=thirdparty%2Fhaproxy.git CLEANUP: Reapply strcmp.cocci (3) This reapplies strcmp.cocci across the whole src/ tree. --- diff --git a/src/cfgparse-ssl.c b/src/cfgparse-ssl.c index 95759ff40..f0a11ade1 100644 --- a/src/cfgparse-ssl.c +++ b/src/cfgparse-ssl.c @@ -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'.", diff --git a/src/cli.c b/src/cli.c index deb6f703f..3bd709898 100644 --- a/src/cli.c +++ b/src/cli.c @@ -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; } diff --git a/src/cpu_topo.c b/src/cpu_topo.c index 28ed76e0c..8cd7c73a4 100644 --- a/src/cpu_topo.c +++ b/src/cpu_topo.c @@ -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; } diff --git a/src/filters.c b/src/filters.c index 7f3d14eaf..944b534e9 100644 --- a/src/filters.c +++ b/src/filters.c @@ -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; } diff --git a/src/log.c b/src/log.c index c4bac892c..570cce27f 100644 --- a/src/log.c +++ b/src/log.c @@ -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.", diff --git a/src/ssl_ckch.c b/src/ssl_ckch.c index 04d7a302f..b6f1a7c80 100644 --- a/src/ssl_ckch.c +++ b/src/ssl_ckch.c @@ -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'.");