]> git.ipfire.org Git - thirdparty/haproxy.git/commitdiff
CLEANUP: Apply strcmp.cocci
authorTim Duesterhus <tim@bastelstu.be>
Sat, 16 Oct 2021 15:48:15 +0000 (17:48 +0200)
committerWilly Tarreau <w@1wt.eu>
Mon, 18 Oct 2021 05:17:04 +0000 (07:17 +0200)
This fixes the use of the various *cmp functions to use != 0 or == 0.

src/cfgparse.c
src/cli.c
src/server.c

index f013928f61416a9221a26f8ee9d7dfb5f7938f50..892170284f11fed9e2b2244a65f95f3876534b73 100644 (file)
@@ -1536,7 +1536,7 @@ static void check_section_position(char *section_name,
                                    const char *file, int linenum,
                                    int *non_global_parsed)
 {
-       if (!strcmp(section_name, "global")) {
+       if (strcmp(section_name, "global") == 0) {
                if (*non_global_parsed == 1)
                        _ha_diag_warning("parsing [%s:%d] : global section detected after a non-global one, the prevalence of their statements is unspecified\n", file, linenum);
        }
index a3ee4c442e93ddd271b1b8e657c1fca262379a3c..6a46f138c702930b603973ae39418d28f3f5aec7 100644 (file)
--- a/src/cli.c
+++ b/src/cli.c
@@ -1714,11 +1714,11 @@ static int cli_parse_expert_experimental_mode(char **args, char *payload, struct
        if (!cli_has_level(appctx, ACCESS_LVL_ADMIN))
                return 1;
 
-       if (!strcmp(args[0], "expert-mode")) {
+       if (strcmp(args[0], "expert-mode") == 0) {
                level = ACCESS_EXPERT;
                level_str = "expert-mode";
        }
-       else if (!strcmp(args[0], "experimental-mode")) {
+       else if (strcmp(args[0], "experimental-mode") == 0) {
                level = ACCESS_EXPERIMENTAL;
                level_str = "experimental-mode";
        }
index b8908cefaf2a03b5cf6d7be104385278416ffe5c..15c4d0536f84f2784b5323a6c96b590134a53550 100644 (file)
@@ -4681,7 +4681,7 @@ static int cli_parse_add_server(char **args, char *payload, struct appctx *appct
 
                while (1) {
                        /* check for duplicate server */
-                       if (!strcmp(srv->id, next->id)) {
+                       if (strcmp(srv->id, next->id) == 0) {
                                ha_alert("Already exists a server with the same name in backend.\n");
                                goto out;
                        }