]> git.ipfire.org Git - thirdparty/haproxy.git/commitdiff
CLEANUP: Reapply strcmp.cocci (2)
authorTim Duesterhus <tim@bastelstu.be>
Fri, 29 Mar 2024 17:21:51 +0000 (18:21 +0100)
committerWilly Tarreau <w@1wt.eu>
Tue, 2 Apr 2024 05:27:33 +0000 (07:27 +0200)
This reapplies strcmp.cocci across the whole src/ tree.

src/event_hdl.c
src/hlua_fcn.c
src/sample.c
src/tcp_act.c

index f5bb5b6e7e88de3614f1329033b2dc7c2b232931..f4f7b19e4d22483dbc9ebfc86b4a88272bd14a3b 100644 (file)
@@ -138,7 +138,7 @@ struct event_hdl_sub_type event_hdl_string_to_sub_type(const char *name)
        int it;
 
        for (it = 0; it < (int)(sizeof(event_hdl_sub_type_map) / sizeof(event_hdl_sub_type_map[0])); it++) {
-               if (!strcmp(name, event_hdl_sub_type_map[it].name))
+               if (strcmp(name, event_hdl_sub_type_map[it].name) == 0)
                        return event_hdl_sub_type_map[it].type;
        }
        return EVENT_HDL_SUB_NONE;
index a13e0f5f41cf408dcae7b0eb08fe97821047d704..7aaab3a381eee853d67d0cd735348d0d158665ac 100644 (file)
@@ -1329,14 +1329,14 @@ static int hlua_server_index(struct lua_State *L)
 {
        const char *key = lua_tostring(L, 2);
 
-       if (!strcmp(key, "name")) {
+       if (strcmp(key, "name") == 0) {
                if (ONLY_ONCE())
                        ha_warning("hlua: use of server 'name' attribute is deprecated and will eventually be removed, please use get_name() function instead: %s\n", hlua_traceback(L, ", "));
                lua_pushvalue(L, 1);
                hlua_server_get_name(L);
                return 1;
        }
-       if (!strcmp(key, "puid")) {
+       if (strcmp(key, "puid") == 0) {
                if (ONLY_ONCE())
                        ha_warning("hlua: use of server 'puid' attribute is deprecated and will eventually be removed, please use get_puid() function instead: %s\n", hlua_traceback(L, ", "));
                lua_pushvalue(L, 1);
@@ -1980,14 +1980,14 @@ static int hlua_proxy_index(struct lua_State *L)
 {
        const char *key = lua_tostring(L, 2);
 
-       if (!strcmp(key, "name")) {
+       if (strcmp(key, "name") == 0) {
                if (ONLY_ONCE())
                        ha_warning("hlua: use of proxy 'name' attribute is deprecated and will eventually be removed, please use get_name() function instead: %s\n", hlua_traceback(L, ", "));
                lua_pushvalue(L, 1);
                hlua_proxy_get_name(L);
                return 1;
        }
-       if (!strcmp(key, "uuid")) {
+       if (strcmp(key, "uuid") == 0) {
                if (ONLY_ONCE())
                        ha_warning("hlua: use of proxy 'uuid' attribute is deprecated and will eventually be removed, please use get_uuid() function instead: %s\n", hlua_traceback(L, ", "));
                lua_pushvalue(L, 1);
index cbb959161b09f26a0b5655e8d5dd2eb62b88424d..8f46d31b96124cad48870f4f899c6ba8b6328bb7 100644 (file)
@@ -69,7 +69,7 @@ int type_to_smp(const char *type)
        int it = 0;
 
        while (it < SMP_TYPES) {
-               if (!strcmp(type, smp_to_type[it]))
+               if (strcmp(type, smp_to_type[it]) == 0)
                        break; // found
                it += 1;
        }
index 1cefc90dcda2d03921db2f7d936fb67259a94da6..a88fab4afe8331fe97a6d1407e46825d0eefd87c 100644 (file)
@@ -678,7 +678,7 @@ static enum act_parse_ret tcp_parse_set_mark(const char **args, int *orig_arg, s
        }
 
        /* Register processing function. */
-       if (!strcmp("set-bc-mark", args[cur_arg - 1]))
+       if (strcmp("set-bc-mark", args[cur_arg - 1]) == 0)
                rule->action_ptr = tcp_action_set_bc_mark;
        else
                rule->action_ptr = tcp_action_set_fc_mark; // fc mark
@@ -740,7 +740,7 @@ static enum act_parse_ret tcp_parse_set_tos(const char **args, int *orig_arg, st
        }
 
        /* Register processing function. */
-       if (!strcmp("set-bc-tos", args[cur_arg - 1]))
+       if (strcmp("set-bc-tos", args[cur_arg - 1]) == 0)
                rule->action_ptr = tcp_action_set_bc_tos;
        else
                rule->action_ptr = tcp_action_set_fc_tos; // fc tos