]> git.ipfire.org Git - thirdparty/haproxy.git/commitdiff
CLEANUP: Reapply strcmp.cocci (3)
authorTim Duesterhus <tim@bastelstu.be>
Tue, 28 Apr 2026 19:59:13 +0000 (21:59 +0200)
committerWilly Tarreau <w@1wt.eu>
Wed, 29 Apr 2026 02:39:12 +0000 (04:39 +0200)
This reapplies strcmp.cocci across the whole src/ tree.

src/cfgparse-ssl.c
src/cli.c
src/cpu_topo.c
src/filters.c
src/log.c
src/ssl_ckch.c

index 95759ff4085a1da5bf62f3ab607a77bd09f34bb4..f0a11ade1fb1695e01b38abf2d2755ff005f8ca9 100644 (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'.",
index deb6f703f684ea194696074a3b20d694e17297a3..3bd70989813e6d65706f171e788b636eeceac445 100644 (file)
--- 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;
                }
index 28ed76e0c86be90e63b85662bc3ad6f1ca91dcd5..8cd7c73a49f489f7edc8891e3fe9560baf831155 100644 (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;
                        }
index 7f3d14eaf8132c599e3e7cc71287cd249675fc60..944b534e91d20625a0502aa4d088a8ec3ac79303 100644 (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;
                }
index c4bac892c74d1412b28eeb8107c406109d7f817d..570cce27fd43e6ae6cafd765627dcfe83a49b861 100644 (file)
--- 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.",
index 04d7a302f1e2097be5acc18b6a99b46a85f34f86..b6f1a7c8030ebb1455dbfdc3802cbc4169ab2ea6 100644 (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'.");