CLEANUP: Reapply strcmp.cocci (2)

This reapplies strcmp.cocci across the whole src/ tree.
This commit is contained in:
Tim Duesterhus 2024-03-29 18:21:51 +01:00 committed by Willy Tarreau
parent cd5d62249f
commit f88ea5949c
4 changed files with 8 additions and 8 deletions

View 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;

View 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);

View 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;
}

View 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