From: Tim Duesterhus Date: Sat, 2 Jan 2021 21:31:53 +0000 (+0100) Subject: CLEANUP: Compare the return value of `XXXcmp()` functions with zero X-Git-Tag: v2.4-dev5~33 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=e5ff14100aceba70714a2d8549ee7621ffc2701e;p=thirdparty%2Fhaproxy.git CLEANUP: Compare the return value of `XXXcmp()` functions with zero According to coding-style.txt it is recommended to use: `strcmp(a, b) == 0` instead of `!strcmp(a, b)` So let's do this. The change was performed by running the following (very long) coccinelle patch on src/: @@ statement S; expression E; expression F; @@ if ( ( dns_hostname_cmp | eb_memcmp | memcmp | strcasecmp | strcmp | strncasecmp | strncmp ) - (E, F) + (E, F) != 0 ) ( S | { ... } ) @@ statement S; expression E; expression F; @@ if ( - ! ( dns_hostname_cmp | eb_memcmp | memcmp | strcasecmp | strcmp | strncasecmp | strncmp ) - (E, F) + (E, F) == 0 ) ( S | { ... } ) @@ expression E; expression F; expression G; @@ ( G && ( dns_hostname_cmp | eb_memcmp | memcmp | strcasecmp | strcmp | strncasecmp | strncmp ) - (E, F) + (E, F) != 0 ) @@ expression E; expression F; expression G; @@ ( G || ( dns_hostname_cmp | eb_memcmp | memcmp | strcasecmp | strcmp | strncasecmp | strncmp ) - (E, F) + (E, F) != 0 ) @@ expression E; expression F; expression G; @@ ( ( dns_hostname_cmp | eb_memcmp | memcmp | strcasecmp | strcmp | strncasecmp | strncmp ) - (E, F) + (E, F) != 0 && G ) @@ expression E; expression F; expression G; @@ ( ( dns_hostname_cmp | eb_memcmp | memcmp | strcasecmp | strcmp | strncasecmp | strncmp ) - (E, F) + (E, F) != 0 || G ) @@ expression E; expression F; expression G; @@ ( G && - ! ( dns_hostname_cmp | eb_memcmp | memcmp | strcasecmp | strcmp | strncasecmp | strncmp ) - (E, F) + (E, F) == 0 ) @@ expression E; expression F; expression G; @@ ( G || - ! ( dns_hostname_cmp | eb_memcmp | memcmp | strcasecmp | strcmp | strncasecmp | strncmp ) - (E, F) + (E, F) == 0 ) @@ expression E; expression F; expression G; @@ ( - ! ( dns_hostname_cmp | eb_memcmp | memcmp | strcasecmp | strcmp | strncasecmp | strncmp ) - (E, F) + (E, F) == 0 && G ) @@ expression E; expression F; expression G; @@ ( - ! ( dns_hostname_cmp | eb_memcmp | memcmp | strcasecmp | strcmp | strncasecmp | strncmp ) - (E, F) + (E, F) == 0 || G ) @@ expression E; expression F; expression G; @@ ( - ! ( dns_hostname_cmp | eb_memcmp | memcmp | strcasecmp | strcmp | strncasecmp | strncmp ) - (E, F) + (E, F) == 0 ) --- diff --git a/src/acl.c b/src/acl.c index abfcf21ccf..b65852f59a 100644 --- a/src/acl.c +++ b/src/acl.c @@ -1026,11 +1026,11 @@ struct acl_cond *build_acl_cond(const char *file, int line, struct list *known_a if (err) *err = NULL; - if (!strcmp(*args, "if")) { + if (strcmp(*args, "if") == 0) { pol = ACL_COND_IF; args++; } - else if (!strcmp(*args, "unless")) { + else if (strcmp(*args, "unless") == 0) { pol = ACL_COND_UNLESS; args++; } @@ -1229,7 +1229,7 @@ int acl_find_targets(struct proxy *p) list_for_each_entry(acl, &p->acl, list) { list_for_each_entry(expr, &acl->expr, list) { - if (!strcmp(expr->kw, "http_auth_group")) { + if (strcmp(expr->kw, "http_auth_group") == 0) { /* Note: the ARGT_USR argument may only have been resolved earlier * by smp_resolve_args(). */ diff --git a/src/action.c b/src/action.c index c4c263faf7..5f4d7c1f85 100644 --- a/src/action.c +++ b/src/action.c @@ -165,10 +165,10 @@ int cfg_parse_rule_set_timeout(const char **args, int idx, int *out_timeout, const char *res; const char *timeout_name = args[idx++]; - if (!strcmp(timeout_name, "server")) { + if (strcmp(timeout_name, "server") == 0) { *name = ACT_TIMEOUT_SERVER; } - else if (!strcmp(timeout_name, "tunnel")) { + else if (strcmp(timeout_name, "tunnel") == 0) { *name = ACT_TIMEOUT_TUNNEL; } else { diff --git a/src/auth.c b/src/auth.c index 65dd6e952f..a3597d83c3 100644 --- a/src/auth.c +++ b/src/auth.c @@ -61,7 +61,7 @@ auth_find_userlist(char *name) return NULL; for (l = userlist; l; l = l->next) - if (!strcmp(l->name, name)) + if (strcmp(l->name, name) == 0) return l; return NULL; @@ -139,7 +139,7 @@ int userlist_postinit() while ((group = strtok(group?NULL:curuser->u.groups_names, ","))) { for (ag = curuserlist->groups; ag; ag = ag->next) { - if (!strcmp(ag->name, group)) + if (strcmp(ag->name, group) == 0) break; } @@ -176,7 +176,7 @@ int userlist_postinit() while ((user = strtok(user?NULL:ag->groupusers, ","))) { for (curuser = curuserlist->users; curuser; curuser = curuser->next) { - if (!strcmp(curuser->user, user)) + if (strcmp(curuser->user, user) == 0) break; } @@ -241,7 +241,7 @@ check_user(struct userlist *ul, const char *user, const char *pass) #endif for (u = ul->users; u; u = u->next) - if (!strcmp(user, u->user)) + if (strcmp(user, u->user) == 0) break; if (!u) diff --git a/src/backend.c b/src/backend.c index 0e8b06dc6c..2f2808a810 100644 --- a/src/backend.c +++ b/src/backend.c @@ -2376,19 +2376,19 @@ int backend_parse_balance(const char **args, char **err, struct proxy *curproxy) return 0; } - if (!strcmp(args[0], "roundrobin")) { + if (strcmp(args[0], "roundrobin") == 0) { curproxy->lbprm.algo &= ~BE_LB_ALGO; curproxy->lbprm.algo |= BE_LB_ALGO_RR; } - else if (!strcmp(args[0], "static-rr")) { + else if (strcmp(args[0], "static-rr") == 0) { curproxy->lbprm.algo &= ~BE_LB_ALGO; curproxy->lbprm.algo |= BE_LB_ALGO_SRR; } - else if (!strcmp(args[0], "first")) { + else if (strcmp(args[0], "first") == 0) { curproxy->lbprm.algo &= ~BE_LB_ALGO; curproxy->lbprm.algo |= BE_LB_ALGO_FAS; } - else if (!strcmp(args[0], "leastconn")) { + else if (strcmp(args[0], "leastconn") == 0) { curproxy->lbprm.algo &= ~BE_LB_ALGO; curproxy->lbprm.algo |= BE_LB_ALGO_LC; } @@ -2418,11 +2418,11 @@ int backend_parse_balance(const char **args, char **err, struct proxy *curproxy) } } } - else if (!strcmp(args[0], "source")) { + else if (strcmp(args[0], "source") == 0) { curproxy->lbprm.algo &= ~BE_LB_ALGO; curproxy->lbprm.algo |= BE_LB_ALGO_SH; } - else if (!strcmp(args[0], "uri")) { + else if (strcmp(args[0], "uri") == 0) { int arg = 1; curproxy->lbprm.algo &= ~BE_LB_ALGO; @@ -2432,7 +2432,7 @@ int backend_parse_balance(const char **args, char **err, struct proxy *curproxy) curproxy->lbprm.arg_opt3 = 0; // "depth" while (*args[arg]) { - if (!strcmp(args[arg], "len")) { + if (strcmp(args[arg], "len") == 0) { if (!*args[arg+1] || (atoi(args[arg+1]) <= 0)) { memprintf(err, "%s : '%s' expects a positive integer (got '%s').", args[0], args[arg], args[arg+1]); return -1; @@ -2440,7 +2440,7 @@ int backend_parse_balance(const char **args, char **err, struct proxy *curproxy) curproxy->lbprm.arg_opt2 = atoi(args[arg+1]); arg += 2; } - else if (!strcmp(args[arg], "depth")) { + else if (strcmp(args[arg], "depth") == 0) { if (!*args[arg+1] || (atoi(args[arg+1]) <= 0)) { memprintf(err, "%s : '%s' expects a positive integer (got '%s').", args[0], args[arg], args[arg+1]); return -1; @@ -2451,11 +2451,11 @@ int backend_parse_balance(const char **args, char **err, struct proxy *curproxy) curproxy->lbprm.arg_opt3 = atoi(args[arg+1]) + 1; arg += 2; } - else if (!strcmp(args[arg], "whole")) { + else if (strcmp(args[arg], "whole") == 0) { curproxy->lbprm.arg_opt1 |= 1; arg += 1; } - else if (!strcmp(args[arg], "path-only")) { + else if (strcmp(args[arg], "path-only") == 0) { curproxy->lbprm.arg_opt1 |= 2; arg += 1; } @@ -2465,7 +2465,7 @@ int backend_parse_balance(const char **args, char **err, struct proxy *curproxy) } } } - else if (!strcmp(args[0], "url_param")) { + else if (strcmp(args[0], "url_param") == 0) { if (!*args[1]) { memprintf(err, "%s requires an URL parameter name.", args[0]); return -1; @@ -2477,7 +2477,7 @@ int backend_parse_balance(const char **args, char **err, struct proxy *curproxy) curproxy->lbprm.arg_str = strdup(args[1]); curproxy->lbprm.arg_len = strlen(args[1]); if (*args[2]) { - if (strcmp(args[2], "check_post")) { + if (strcmp(args[2], "check_post") != 0) { memprintf(err, "%s only accepts 'check_post' modifier (got '%s').", args[0], args[2]); return -1; } @@ -2503,7 +2503,7 @@ int backend_parse_balance(const char **args, char **err, struct proxy *curproxy) curproxy->lbprm.arg_opt1 = 0; if (*args[1]) { - if (strcmp(args[1], "use_domain_only")) { + if (strcmp(args[1], "use_domain_only") != 0) { memprintf(err, "%s only accepts 'use_domain_only' modifier (got '%s').", args[0], args[1]); return -1; } diff --git a/src/cache.c b/src/cache.c index 23883df967..a0b417e2ea 100644 --- a/src/cache.c +++ b/src/cache.c @@ -451,7 +451,7 @@ cache_store_check(struct proxy *px, struct flt_conf *fconf) * post_check. */ list_for_each_entry(cache, &caches_config, list) { - if (!strcmp(cache->id, cconf->c.name)) + if (strcmp(cache->id, cconf->c.name) == 0) goto found; } @@ -1555,7 +1555,7 @@ static int parse_cache_rule(struct proxy *proxy, const char *name, struct act_ru list_for_each_entry(fconf, &proxy->filter_configs, list) { if (fconf->id == cache_store_flt_id) { cconf = fconf->conf; - if (cconf && !strcmp((char *)cconf->c.name, name)) { + if (cconf && strcmp((char *)cconf->c.name, name) == 0) { rule->arg.act.p[0] = cconf; return 1; } @@ -2111,7 +2111,7 @@ int post_check_cache() continue; cconf = fconf->conf; - if (!strcmp(cache->id, cconf->c.name)) { + if (strcmp(cache->id, cconf->c.name) == 0) { free(cconf->c.name); cconf->flags |= CACHE_FLT_INIT; cconf->c.cache = cache; @@ -2545,7 +2545,7 @@ parse_cache_flt(char **args, int *cur_arg, struct proxy *px, continue; cconf = f->conf; - if (strcmp(name, cconf->c.name)) { + if (strcmp(name, cconf->c.name) != 0) { cconf = NULL; continue; } diff --git a/src/cfgparse-global.c b/src/cfgparse-global.c index ba7249e1fe..ddb5e4cf16 100644 --- a/src/cfgparse-global.c +++ b/src/cfgparse-global.c @@ -34,21 +34,21 @@ int cfg_parse_global(const char *file, int linenum, char **args, int kwm) int err_code = 0; char *errmsg = NULL; - if (!strcmp(args[0], "global")) { /* new section */ + if (strcmp(args[0], "global") == 0) { /* new section */ /* no option, nothing special to do */ alertif_too_many_args(0, file, linenum, args, &err_code); goto out; } - else if (!strcmp(args[0], "daemon")) { + else if (strcmp(args[0], "daemon") == 0) { if (alertif_too_many_args(0, file, linenum, args, &err_code)) goto out; global.mode |= MODE_DAEMON; } - else if (!strcmp(args[0], "master-worker")) { + else if (strcmp(args[0], "master-worker") == 0) { if (alertif_too_many_args(1, file, linenum, args, &err_code)) goto out; if (*args[1]) { - if (!strcmp(args[1], "no-exit-on-failure")) { + if (strcmp(args[1], "no-exit-on-failure") == 0) { global.tune.options |= GTUNE_NOEXIT_ONFAILURE; } else { ha_alert("parsing [%s:%d] : '%s' only supports 'no-exit-on-failure' option.\n", file, linenum, args[0]); @@ -58,27 +58,27 @@ int cfg_parse_global(const char *file, int linenum, char **args, int kwm) } global.mode |= MODE_MWORKER; } - else if (!strcmp(args[0], "noepoll")) { + else if (strcmp(args[0], "noepoll") == 0) { if (alertif_too_many_args(0, file, linenum, args, &err_code)) goto out; global.tune.options &= ~GTUNE_USE_EPOLL; } - else if (!strcmp(args[0], "nokqueue")) { + else if (strcmp(args[0], "nokqueue") == 0) { if (alertif_too_many_args(0, file, linenum, args, &err_code)) goto out; global.tune.options &= ~GTUNE_USE_KQUEUE; } - else if (!strcmp(args[0], "noevports")) { + else if (strcmp(args[0], "noevports") == 0) { if (alertif_too_many_args(0, file, linenum, args, &err_code)) goto out; global.tune.options &= ~GTUNE_USE_EVPORTS; } - else if (!strcmp(args[0], "nopoll")) { + else if (strcmp(args[0], "nopoll") == 0) { if (alertif_too_many_args(0, file, linenum, args, &err_code)) goto out; global.tune.options &= ~GTUNE_USE_POLL; } - else if (!strcmp(args[0], "busy-polling")) { /* "no busy-polling" or "busy-polling" */ + else if (strcmp(args[0], "busy-polling") == 0) { /* "no busy-polling" or "busy-polling" */ if (alertif_too_many_args(0, file, linenum, args, &err_code)) goto out; if (kwm == KWM_NO) @@ -86,7 +86,7 @@ int cfg_parse_global(const char *file, int linenum, char **args, int kwm) else global.tune.options |= GTUNE_BUSY_POLLING; } - else if (!strcmp(args[0], "set-dumpable")) { /* "no set-dumpable" or "set-dumpable" */ + else if (strcmp(args[0], "set-dumpable") == 0) { /* "no set-dumpable" or "set-dumpable" */ if (alertif_too_many_args(0, file, linenum, args, &err_code)) goto out; if (kwm == KWM_NO) @@ -94,7 +94,7 @@ int cfg_parse_global(const char *file, int linenum, char **args, int kwm) else global.tune.options |= GTUNE_SET_DUMPABLE; } - else if (!strcmp(args[0], "insecure-fork-wanted")) { /* "no insecure-fork-wanted" or "insecure-fork-wanted" */ + else if (strcmp(args[0], "insecure-fork-wanted") == 0) { /* "no insecure-fork-wanted" or "insecure-fork-wanted" */ if (alertif_too_many_args(0, file, linenum, args, &err_code)) goto out; if (kwm == KWM_NO) @@ -102,7 +102,7 @@ int cfg_parse_global(const char *file, int linenum, char **args, int kwm) else global.tune.options |= GTUNE_INSECURE_FORK; } - else if (!strcmp(args[0], "insecure-setuid-wanted")) { /* "no insecure-setuid-wanted" or "insecure-setuid-wanted" */ + else if (strcmp(args[0], "insecure-setuid-wanted") == 0) { /* "no insecure-setuid-wanted" or "insecure-setuid-wanted" */ if (alertif_too_many_args(0, file, linenum, args, &err_code)) goto out; if (kwm == KWM_NO) @@ -110,32 +110,32 @@ int cfg_parse_global(const char *file, int linenum, char **args, int kwm) else global.tune.options |= GTUNE_INSECURE_SETUID; } - else if (!strcmp(args[0], "nosplice")) { + else if (strcmp(args[0], "nosplice") == 0) { if (alertif_too_many_args(0, file, linenum, args, &err_code)) goto out; global.tune.options &= ~GTUNE_USE_SPLICE; } - else if (!strcmp(args[0], "nogetaddrinfo")) { + else if (strcmp(args[0], "nogetaddrinfo") == 0) { if (alertif_too_many_args(0, file, linenum, args, &err_code)) goto out; global.tune.options &= ~GTUNE_USE_GAI; } - else if (!strcmp(args[0], "noreuseport")) { + else if (strcmp(args[0], "noreuseport") == 0) { if (alertif_too_many_args(0, file, linenum, args, &err_code)) goto out; global.tune.options &= ~GTUNE_USE_REUSEPORT; } - else if (!strcmp(args[0], "quiet")) { + else if (strcmp(args[0], "quiet") == 0) { if (alertif_too_many_args(0, file, linenum, args, &err_code)) goto out; global.mode |= MODE_QUIET; } - else if (!strcmp(args[0], "zero-warning")) { + else if (strcmp(args[0], "zero-warning") == 0) { if (alertif_too_many_args(0, file, linenum, args, &err_code)) goto out; global.mode |= MODE_ZERO_WARNING; } - else if (!strcmp(args[0], "tune.runqueue-depth")) { + else if (strcmp(args[0], "tune.runqueue-depth") == 0) { if (alertif_too_many_args(1, file, linenum, args, &err_code)) goto out; if (global.tune.runqueue_depth != 0) { @@ -151,7 +151,7 @@ int cfg_parse_global(const char *file, int linenum, char **args, int kwm) global.tune.runqueue_depth = atol(args[1]); } - else if (!strcmp(args[0], "tune.maxpollevents")) { + else if (strcmp(args[0], "tune.maxpollevents") == 0) { if (alertif_too_many_args(1, file, linenum, args, &err_code)) goto out; if (global.tune.maxpollevents != 0) { @@ -166,7 +166,7 @@ int cfg_parse_global(const char *file, int linenum, char **args, int kwm) } global.tune.maxpollevents = atol(args[1]); } - else if (!strcmp(args[0], "tune.maxaccept")) { + else if (strcmp(args[0], "tune.maxaccept") == 0) { long max; if (alertif_too_many_args(1, file, linenum, args, &err_code)) @@ -189,11 +189,11 @@ int cfg_parse_global(const char *file, int linenum, char **args, int kwm) } global.tune.maxaccept = max; } - else if (!strcmp(args[0], "tune.chksize")) { + else if (strcmp(args[0], "tune.chksize") == 0) { ha_warning("parsing [%s:%d]: the option '%s' is deprecated and will be removed in next version.\n", file, linenum, args[0]); } - else if (!strcmp(args[0], "tune.recv_enough")) { + else if (strcmp(args[0], "tune.recv_enough") == 0) { if (alertif_too_many_args(1, file, linenum, args, &err_code)) goto out; if (*(args[1]) == 0) { @@ -203,7 +203,7 @@ int cfg_parse_global(const char *file, int linenum, char **args, int kwm) } global.tune.recv_enough = atol(args[1]); } - else if (!strcmp(args[0], "tune.buffers.limit")) { + else if (strcmp(args[0], "tune.buffers.limit") == 0) { if (alertif_too_many_args(1, file, linenum, args, &err_code)) goto out; if (*(args[1]) == 0) { @@ -219,7 +219,7 @@ int cfg_parse_global(const char *file, int linenum, char **args, int kwm) global.tune.buf_limit = global.tune.reserved_bufs + 1; } } - else if (!strcmp(args[0], "tune.buffers.reserve")) { + else if (strcmp(args[0], "tune.buffers.reserve") == 0) { if (alertif_too_many_args(1, file, linenum, args, &err_code)) goto out; if (*(args[1]) == 0) { @@ -233,7 +233,7 @@ int cfg_parse_global(const char *file, int linenum, char **args, int kwm) if (global.tune.buf_limit && global.tune.buf_limit <= global.tune.reserved_bufs) global.tune.buf_limit = global.tune.reserved_bufs + 1; } - else if (!strcmp(args[0], "tune.bufsize")) { + else if (strcmp(args[0], "tune.bufsize") == 0) { if (alertif_too_many_args(1, file, linenum, args, &err_code)) goto out; if (*(args[1]) == 0) { @@ -250,7 +250,7 @@ int cfg_parse_global(const char *file, int linenum, char **args, int kwm) goto out; } } - else if (!strcmp(args[0], "tune.maxrewrite")) { + else if (strcmp(args[0], "tune.maxrewrite") == 0) { if (alertif_too_many_args(1, file, linenum, args, &err_code)) goto out; if (*(args[1]) == 0) { @@ -265,7 +265,7 @@ int cfg_parse_global(const char *file, int linenum, char **args, int kwm) goto out; } } - else if (!strcmp(args[0], "tune.idletimer")) { + else if (strcmp(args[0], "tune.idletimer") == 0) { unsigned int idle; const char *res; @@ -304,7 +304,7 @@ int cfg_parse_global(const char *file, int linenum, char **args, int kwm) } global.tune.idle_timer = idle; } - else if (!strcmp(args[0], "tune.rcvbuf.client")) { + else if (strcmp(args[0], "tune.rcvbuf.client") == 0) { if (alertif_too_many_args(1, file, linenum, args, &err_code)) goto out; if (global.tune.client_rcvbuf != 0) { @@ -319,7 +319,7 @@ int cfg_parse_global(const char *file, int linenum, char **args, int kwm) } global.tune.client_rcvbuf = atol(args[1]); } - else if (!strcmp(args[0], "tune.rcvbuf.server")) { + else if (strcmp(args[0], "tune.rcvbuf.server") == 0) { if (alertif_too_many_args(1, file, linenum, args, &err_code)) goto out; if (global.tune.server_rcvbuf != 0) { @@ -334,7 +334,7 @@ int cfg_parse_global(const char *file, int linenum, char **args, int kwm) } global.tune.server_rcvbuf = atol(args[1]); } - else if (!strcmp(args[0], "tune.sndbuf.client")) { + else if (strcmp(args[0], "tune.sndbuf.client") == 0) { if (alertif_too_many_args(1, file, linenum, args, &err_code)) goto out; if (global.tune.client_sndbuf != 0) { @@ -349,7 +349,7 @@ int cfg_parse_global(const char *file, int linenum, char **args, int kwm) } global.tune.client_sndbuf = atol(args[1]); } - else if (!strcmp(args[0], "tune.sndbuf.server")) { + else if (strcmp(args[0], "tune.sndbuf.server") == 0) { if (alertif_too_many_args(1, file, linenum, args, &err_code)) goto out; if (global.tune.server_sndbuf != 0) { @@ -364,7 +364,7 @@ int cfg_parse_global(const char *file, int linenum, char **args, int kwm) } global.tune.server_sndbuf = atol(args[1]); } - else if (!strcmp(args[0], "tune.pipesize")) { + else if (strcmp(args[0], "tune.pipesize") == 0) { if (alertif_too_many_args(1, file, linenum, args, &err_code)) goto out; if (*(args[1]) == 0) { @@ -374,7 +374,7 @@ int cfg_parse_global(const char *file, int linenum, char **args, int kwm) } global.tune.pipesize = atol(args[1]); } - else if (!strcmp(args[0], "tune.http.cookielen")) { + else if (strcmp(args[0], "tune.http.cookielen") == 0) { if (alertif_too_many_args(1, file, linenum, args, &err_code)) goto out; if (*(args[1]) == 0) { @@ -384,7 +384,7 @@ int cfg_parse_global(const char *file, int linenum, char **args, int kwm) } global.tune.cookie_len = atol(args[1]) + 1; } - else if (!strcmp(args[0], "tune.http.logurilen")) { + else if (strcmp(args[0], "tune.http.logurilen") == 0) { if (alertif_too_many_args(1, file, linenum, args, &err_code)) goto out; if (*(args[1]) == 0) { @@ -394,7 +394,7 @@ int cfg_parse_global(const char *file, int linenum, char **args, int kwm) } global.tune.requri_len = atol(args[1]) + 1; } - else if (!strcmp(args[0], "tune.http.maxhdr")) { + else if (strcmp(args[0], "tune.http.maxhdr") == 0) { if (alertif_too_many_args(1, file, linenum, args, &err_code)) goto out; if (*(args[1]) == 0) { @@ -410,7 +410,7 @@ int cfg_parse_global(const char *file, int linenum, char **args, int kwm) goto out; } } - else if (!strcmp(args[0], "tune.comp.maxlevel")) { + else if (strcmp(args[0], "tune.comp.maxlevel") == 0) { if (alertif_too_many_args(1, file, linenum, args, &err_code)) goto out; if (*args[1]) { @@ -428,7 +428,7 @@ int cfg_parse_global(const char *file, int linenum, char **args, int kwm) goto out; } } - else if (!strcmp(args[0], "tune.pattern.cache-size")) { + else if (strcmp(args[0], "tune.pattern.cache-size") == 0) { if (*args[1]) { global.tune.pattern_cache = atoi(args[1]); if (global.tune.pattern_cache < 0) { @@ -444,7 +444,7 @@ int cfg_parse_global(const char *file, int linenum, char **args, int kwm) goto out; } } - else if (!strcmp(args[0], "uid")) { + else if (strcmp(args[0], "uid") == 0) { if (alertif_too_many_args(1, file, linenum, args, &err_code)) goto out; if (global.uid != 0) { @@ -464,7 +464,7 @@ int cfg_parse_global(const char *file, int linenum, char **args, int kwm) } } - else if (!strcmp(args[0], "gid")) { + else if (strcmp(args[0], "gid") == 0) { if (alertif_too_many_args(1, file, linenum, args, &err_code)) goto out; if (global.gid != 0) { @@ -483,13 +483,13 @@ int cfg_parse_global(const char *file, int linenum, char **args, int kwm) goto out; } } - else if (!strcmp(args[0], "external-check")) { + else if (strcmp(args[0], "external-check") == 0) { if (alertif_too_many_args(0, file, linenum, args, &err_code)) goto out; global.external_check = 1; } /* user/group name handling */ - else if (!strcmp(args[0], "user")) { + else if (strcmp(args[0], "user") == 0) { struct passwd *ha_user; if (alertif_too_many_args(1, file, linenum, args, &err_code)) goto out; @@ -508,7 +508,7 @@ int cfg_parse_global(const char *file, int linenum, char **args, int kwm) err_code |= ERR_ALERT | ERR_FATAL; } } - else if (!strcmp(args[0], "group")) { + else if (strcmp(args[0], "group") == 0) { struct group *ha_group; if (alertif_too_many_args(1, file, linenum, args, &err_code)) goto out; @@ -528,7 +528,7 @@ int cfg_parse_global(const char *file, int linenum, char **args, int kwm) } } /* end of user/group name handling*/ - else if (!strcmp(args[0], "nbproc")) { + else if (strcmp(args[0], "nbproc") == 0) { if (alertif_too_many_args(1, file, linenum, args, &err_code)) goto out; if (*(args[1]) == 0) { @@ -545,7 +545,7 @@ int cfg_parse_global(const char *file, int linenum, char **args, int kwm) goto out; } } - else if (!strcmp(args[0], "nbthread")) { + else if (strcmp(args[0], "nbthread") == 0) { if (alertif_too_many_args(1, file, linenum, args, &err_code)) goto out; if (*(args[1]) == 0) { @@ -561,7 +561,7 @@ int cfg_parse_global(const char *file, int linenum, char **args, int kwm) goto out; } } - else if (!strcmp(args[0], "maxconn")) { + else if (strcmp(args[0], "maxconn") == 0) { if (alertif_too_many_args(1, file, linenum, args, &err_code)) goto out; if (global.maxconn != 0) { @@ -583,7 +583,7 @@ int cfg_parse_global(const char *file, int linenum, char **args, int kwm) } #endif /* SYSTEM_MAXCONN */ } - else if (!strcmp(args[0], "ssl-server-verify")) { + else if (strcmp(args[0], "ssl-server-verify") == 0) { if (alertif_too_many_args(1, file, linenum, args, &err_code)) goto out; if (*(args[1]) == 0) { @@ -601,7 +601,7 @@ int cfg_parse_global(const char *file, int linenum, char **args, int kwm) goto out; } } - else if (!strcmp(args[0], "maxconnrate")) { + else if (strcmp(args[0], "maxconnrate") == 0) { if (alertif_too_many_args(1, file, linenum, args, &err_code)) goto out; if (global.cps_lim != 0) { @@ -616,7 +616,7 @@ int cfg_parse_global(const char *file, int linenum, char **args, int kwm) } global.cps_lim = atol(args[1]); } - else if (!strcmp(args[0], "maxsessrate")) { + else if (strcmp(args[0], "maxsessrate") == 0) { if (alertif_too_many_args(1, file, linenum, args, &err_code)) goto out; if (global.sps_lim != 0) { @@ -631,7 +631,7 @@ int cfg_parse_global(const char *file, int linenum, char **args, int kwm) } global.sps_lim = atol(args[1]); } - else if (!strcmp(args[0], "maxsslrate")) { + else if (strcmp(args[0], "maxsslrate") == 0) { if (alertif_too_many_args(1, file, linenum, args, &err_code)) goto out; if (global.ssl_lim != 0) { @@ -646,7 +646,7 @@ int cfg_parse_global(const char *file, int linenum, char **args, int kwm) } global.ssl_lim = atol(args[1]); } - else if (!strcmp(args[0], "maxcomprate")) { + else if (strcmp(args[0], "maxcomprate") == 0) { if (alertif_too_many_args(1, file, linenum, args, &err_code)) goto out; if (*(args[1]) == 0) { @@ -656,7 +656,7 @@ int cfg_parse_global(const char *file, int linenum, char **args, int kwm) } global.comp_rate_lim = atoi(args[1]) * 1024; } - else if (!strcmp(args[0], "maxpipes")) { + else if (strcmp(args[0], "maxpipes") == 0) { if (alertif_too_many_args(1, file, linenum, args, &err_code)) goto out; if (global.maxpipes != 0) { @@ -671,7 +671,7 @@ int cfg_parse_global(const char *file, int linenum, char **args, int kwm) } global.maxpipes = atol(args[1]); } - else if (!strcmp(args[0], "maxzlibmem")) { + else if (strcmp(args[0], "maxzlibmem") == 0) { if (alertif_too_many_args(1, file, linenum, args, &err_code)) goto out; if (*(args[1]) == 0) { @@ -681,7 +681,7 @@ int cfg_parse_global(const char *file, int linenum, char **args, int kwm) } global.maxzlibmem = atol(args[1]) * 1024L * 1024L; } - else if (!strcmp(args[0], "maxcompcpuusage")) { + else if (strcmp(args[0], "maxcompcpuusage") == 0) { if (alertif_too_many_args(1, file, linenum, args, &err_code)) goto out; if (*(args[1]) == 0) { @@ -697,7 +697,7 @@ int cfg_parse_global(const char *file, int linenum, char **args, int kwm) } } - else if (!strcmp(args[0], "ulimit-n")) { + else if (strcmp(args[0], "ulimit-n") == 0) { if (alertif_too_many_args(1, file, linenum, args, &err_code)) goto out; if (global.rlimit_nofile != 0) { @@ -712,7 +712,7 @@ int cfg_parse_global(const char *file, int linenum, char **args, int kwm) } global.rlimit_nofile = atol(args[1]); } - else if (!strcmp(args[0], "chroot")) { + else if (strcmp(args[0], "chroot") == 0) { if (alertif_too_many_args(1, file, linenum, args, &err_code)) goto out; if (global.chroot != NULL) { @@ -727,7 +727,7 @@ int cfg_parse_global(const char *file, int linenum, char **args, int kwm) } global.chroot = strdup(args[1]); } - else if (!strcmp(args[0], "description")) { + else if (strcmp(args[0], "description") == 0) { int i, len=0; char *d; @@ -750,7 +750,7 @@ int cfg_parse_global(const char *file, int linenum, char **args, int kwm) for (i = 2; *args[i]; i++) d += snprintf(d, global.desc + len - d, " %s", args[i]); } - else if (!strcmp(args[0], "node")) { + else if (strcmp(args[0], "node") == 0) { int i; char c; @@ -777,7 +777,7 @@ int cfg_parse_global(const char *file, int linenum, char **args, int kwm) global.node = strdup(args[1]); } - else if (!strcmp(args[0], "pidfile")) { + else if (strcmp(args[0], "pidfile") == 0) { if (alertif_too_many_args(1, file, linenum, args, &err_code)) goto out; if (global.pidfile != NULL) { @@ -792,10 +792,10 @@ int cfg_parse_global(const char *file, int linenum, char **args, int kwm) } global.pidfile = strdup(args[1]); } - else if (!strcmp(args[0], "unix-bind")) { + else if (strcmp(args[0], "unix-bind") == 0) { int cur_arg = 1; while (*(args[cur_arg])) { - if (!strcmp(args[cur_arg], "prefix")) { + if (strcmp(args[cur_arg], "prefix") == 0) { if (global.unix_bind.prefix != NULL) { ha_alert("parsing [%s:%d] : unix-bind '%s' already specified. Continuing.\n", file, linenum, args[cur_arg]); err_code |= ERR_ALERT; @@ -813,28 +813,28 @@ int cfg_parse_global(const char *file, int linenum, char **args, int kwm) continue; } - if (!strcmp(args[cur_arg], "mode")) { + if (strcmp(args[cur_arg], "mode") == 0) { global.unix_bind.ux.mode = strtol(args[cur_arg + 1], NULL, 8); cur_arg += 2; continue; } - if (!strcmp(args[cur_arg], "uid")) { + if (strcmp(args[cur_arg], "uid") == 0) { global.unix_bind.ux.uid = atol(args[cur_arg + 1 ]); cur_arg += 2; continue; } - if (!strcmp(args[cur_arg], "gid")) { + if (strcmp(args[cur_arg], "gid") == 0) { global.unix_bind.ux.gid = atol(args[cur_arg + 1 ]); cur_arg += 2; continue; } - if (!strcmp(args[cur_arg], "user")) { + if (strcmp(args[cur_arg], "user") == 0) { struct passwd *user; user = getpwnam(args[cur_arg + 1]); @@ -850,7 +850,7 @@ int cfg_parse_global(const char *file, int linenum, char **args, int kwm) continue; } - if (!strcmp(args[cur_arg], "group")) { + if (strcmp(args[cur_arg], "group") == 0) { struct group *group; group = getgrnam(args[cur_arg + 1]); @@ -872,14 +872,14 @@ int cfg_parse_global(const char *file, int linenum, char **args, int kwm) goto out; } } - else if (!strcmp(args[0], "log")) { /* "no log" or "log ..." */ + else if (strcmp(args[0], "log") == 0) { /* "no log" or "log ..." */ if (!parse_logsrv(args, &global.logsrvs, (kwm == KWM_NO), &errmsg)) { ha_alert("parsing [%s:%d] : %s : %s\n", file, linenum, args[0], errmsg); err_code |= ERR_ALERT | ERR_FATAL; goto out; } } - else if (!strcmp(args[0], "log-send-hostname")) { /* set the hostname in syslog header */ + else if (strcmp(args[0], "log-send-hostname") == 0) { /* set the hostname in syslog header */ char *name; if (global.log_send_hostname != NULL) { @@ -896,7 +896,7 @@ int cfg_parse_global(const char *file, int linenum, char **args, int kwm) free(global.log_send_hostname); global.log_send_hostname = strdup(name); } - else if (!strcmp(args[0], "server-state-base")) { /* path base where HAProxy can find server state files */ + else if (strcmp(args[0], "server-state-base") == 0) { /* path base where HAProxy can find server state files */ if (global.server_state_base != NULL) { ha_alert("parsing [%s:%d] : '%s' already specified. Continuing.\n", file, linenum, args[0]); err_code |= ERR_ALERT; @@ -911,7 +911,7 @@ int cfg_parse_global(const char *file, int linenum, char **args, int kwm) global.server_state_base = strdup(args[1]); } - else if (!strcmp(args[0], "server-state-file")) { /* path to the file where HAProxy can load the server states */ + else if (strcmp(args[0], "server-state-file") == 0) { /* path to the file where HAProxy can load the server states */ if (global.server_state_file != NULL) { ha_alert("parsing [%s:%d] : '%s' already specified. Continuing.\n", file, linenum, args[0]); err_code |= ERR_ALERT; @@ -926,7 +926,7 @@ int cfg_parse_global(const char *file, int linenum, char **args, int kwm) global.server_state_file = strdup(args[1]); } - else if (!strcmp(args[0], "log-tag")) { /* tag to report to syslog */ + else if (strcmp(args[0], "log-tag") == 0) { /* tag to report to syslog */ if (alertif_too_many_args(1, file, linenum, args, &err_code)) goto out; if (*(args[1]) == 0) { @@ -943,7 +943,7 @@ int cfg_parse_global(const char *file, int linenum, char **args, int kwm) goto out; } } - else if (!strcmp(args[0], "spread-checks")) { /* random time between checks (0-50) */ + else if (strcmp(args[0], "spread-checks") == 0) { /* random time between checks (0-50) */ if (alertif_too_many_args(1, file, linenum, args, &err_code)) goto out; if (global.spread_checks != 0) { @@ -962,7 +962,7 @@ int cfg_parse_global(const char *file, int linenum, char **args, int kwm) err_code |= ERR_ALERT | ERR_FATAL; } } - else if (!strcmp(args[0], "max-spread-checks")) { /* maximum time between first and last check */ + else if (strcmp(args[0], "max-spread-checks") == 0) { /* maximum time between first and last check */ const char *err; unsigned int val; @@ -1138,7 +1138,7 @@ int cfg_parse_global(const char *file, int linenum, char **args, int kwm) goto out; } } - else if (!strcmp(args[0], "unsetenv")) { + else if (strcmp(args[0], "unsetenv") == 0) { int arg; if (*(args[1]) == 0) { @@ -1155,7 +1155,7 @@ int cfg_parse_global(const char *file, int linenum, char **args, int kwm) } } } - else if (!strcmp(args[0], "resetenv")) { + else if (strcmp(args[0], "resetenv") == 0) { extern char **environ; char **env = environ; @@ -1193,13 +1193,13 @@ int cfg_parse_global(const char *file, int linenum, char **args, int kwm) env++; } } - else if (!strcmp(args[0], "strict-limits")) { /* "no strict-limits" or "strict-limits" */ + else if (strcmp(args[0], "strict-limits") == 0) { /* "no strict-limits" or "strict-limits" */ if (alertif_too_many_args(0, file, linenum, args, &err_code)) goto out; if (kwm == KWM_NO) global.tune.options &= ~GTUNE_STRICT_LIMITS; } - else if (!strcmp(args[0], "localpeer")) { + else if (strcmp(args[0], "localpeer") == 0) { if (alertif_too_many_args(1, file, linenum, args, &err_code)) goto out; diff --git a/src/cfgparse-listen.c b/src/cfgparse-listen.c index a493e741cd..6678e15d1a 100644 --- a/src/cfgparse-listen.c +++ b/src/cfgparse-listen.c @@ -178,11 +178,11 @@ int cfg_parse_listen(const char *file, int linenum, char **args, int kwm) char *errmsg = NULL; struct bind_conf *bind_conf; - if (!strcmp(args[0], "listen")) + if (strcmp(args[0], "listen") == 0) rc = PR_CAP_LISTEN; - else if (!strcmp(args[0], "frontend")) + else if (strcmp(args[0], "frontend") == 0) rc = PR_CAP_FE; - else if (!strcmp(args[0], "backend")) + else if (strcmp(args[0], "backend") == 0) rc = PR_CAP_BE; else rc = PR_CAP_NONE; @@ -477,7 +477,7 @@ int cfg_parse_listen(const char *file, int linenum, char **args, int kwm) goto out; } - else if (!strcmp(args[0], "defaults")) { /* use this one to assign default values */ + else if (strcmp(args[0], "defaults") == 0) { /* use this one to assign default values */ /* some variables may have already been initialized earlier */ /* FIXME-20070101: we should do this too at the end of the * config parsing to free all default values. @@ -545,14 +545,14 @@ int cfg_parse_listen(const char *file, int linenum, char **args, int kwm) curproxy->conf.args.line = linenum; /* Now let's parse the proxy-specific keywords */ - if (!strcmp(args[0], "server") || - !strcmp(args[0], "default-server") || - !strcmp(args[0], "server-template")) { + if (strcmp(args[0], "server") == 0 || + strcmp(args[0], "default-server") == 0 || + strcmp(args[0], "server-template") == 0) { err_code |= parse_server(file, linenum, args, curproxy, &defproxy, 1, 0, 0); if (err_code & ERR_FATAL) goto out; } - else if (!strcmp(args[0], "bind")) { /* new listen addresses */ + else if (strcmp(args[0], "bind") == 0) { /* new listen addresses */ struct listener *l; int cur_arg; @@ -660,12 +660,12 @@ int cfg_parse_listen(const char *file, int linenum, char **args, int kwm) } goto out; } - else if (!strcmp(args[0], "monitor-net")) { /* set the range of IPs to ignore */ + else if (strcmp(args[0], "monitor-net") == 0) { /* set the range of IPs to ignore */ ha_alert("parsing [%s:%d] : 'monitor-net' doesn't exist anymore. Please use 'http-request return status 200 if { src %s }' instead.\n", file, linenum, args[1]); err_code |= ERR_ALERT | ERR_FATAL; goto out; } - else if (!strcmp(args[0], "monitor-uri")) { /* set the URI to intercept */ + else if (strcmp(args[0], "monitor-uri") == 0) { /* set the URI to intercept */ if (warnifnotcap(curproxy, PR_CAP_FE, file, linenum, args[0], NULL)) err_code |= ERR_WARN; @@ -687,13 +687,13 @@ int cfg_parse_listen(const char *file, int linenum, char **args, int kwm) goto out; } - else if (!strcmp(args[0], "mode")) { /* sets the proxy mode */ + else if (strcmp(args[0], "mode") == 0) { /* sets the proxy mode */ if (alertif_too_many_args(1, file, linenum, args, &err_code)) goto out; - if (!strcmp(args[1], "http")) curproxy->mode = PR_MODE_HTTP; - else if (!strcmp(args[1], "tcp")) curproxy->mode = PR_MODE_TCP; - else if (!strcmp(args[1], "health")) { + if (strcmp(args[1], "http") == 0) curproxy->mode = PR_MODE_HTTP; + else if (strcmp(args[1], "tcp") == 0) curproxy->mode = PR_MODE_TCP; + else if (strcmp(args[1], "health") == 0) { ha_alert("parsing [%s:%d] : 'mode health' doesn't exist anymore. Please use 'http-request return status 200' instead.\n", file, linenum); err_code |= ERR_ALERT | ERR_FATAL; goto out; @@ -704,7 +704,7 @@ int cfg_parse_listen(const char *file, int linenum, char **args, int kwm) goto out; } } - else if (!strcmp(args[0], "id")) { + else if (strcmp(args[0], "id") == 0) { struct eb32_node *node; if (curproxy == &defproxy) { @@ -746,7 +746,7 @@ int cfg_parse_listen(const char *file, int linenum, char **args, int kwm) } eb32_insert(&used_proxy_id, &curproxy->conf.id); } - else if (!strcmp(args[0], "description")) { + else if (strcmp(args[0], "description") == 0) { int i, len=0; char *d; @@ -774,17 +774,17 @@ int cfg_parse_listen(const char *file, int linenum, char **args, int kwm) d += snprintf(d, curproxy->desc + len - d, " %s", args[i]); } - else if (!strcmp(args[0], "disabled")) { /* disables this proxy */ + else if (strcmp(args[0], "disabled") == 0) { /* disables this proxy */ if (alertif_too_many_args(0, file, linenum, args, &err_code)) goto out; curproxy->disabled = 1; } - else if (!strcmp(args[0], "enabled")) { /* enables this proxy (used to revert a disabled default) */ + else if (strcmp(args[0], "enabled") == 0) { /* enables this proxy (used to revert a disabled default) */ if (alertif_too_many_args(0, file, linenum, args, &err_code)) goto out; curproxy->disabled = 0; } - else if (!strcmp(args[0], "bind-process")) { /* enable this proxy only on some processes */ + else if (strcmp(args[0], "bind-process") == 0) { /* enable this proxy only on some processes */ int cur_arg = 1; unsigned long set = 0; @@ -802,7 +802,7 @@ int cfg_parse_listen(const char *file, int linenum, char **args, int kwm) } curproxy->bind_proc = set; } - else if (!strcmp(args[0], "acl")) { /* add an ACL */ + else if (strcmp(args[0], "acl") == 0) { /* add an ACL */ if (curproxy == &defproxy) { ha_alert("parsing [%s:%d] : '%s' not allowed in 'defaults' section.\n", file, linenum, args[0]); err_code |= ERR_ALERT | ERR_FATAL; @@ -832,7 +832,7 @@ int cfg_parse_listen(const char *file, int linenum, char **args, int kwm) goto out; } } - else if (!strcmp(args[0], "dynamic-cookie-key")) { /* Dynamic cookies secret key */ + else if (strcmp(args[0], "dynamic-cookie-key") == 0) { /* Dynamic cookies secret key */ if (warnifnotcap(curproxy, PR_CAP_BE, file, linenum, args[0], NULL)) err_code |= ERR_WARN; @@ -846,7 +846,7 @@ int cfg_parse_listen(const char *file, int linenum, char **args, int kwm) free(curproxy->dyncookie_key); curproxy->dyncookie_key = strdup(args[1]); } - else if (!strcmp(args[0], "cookie")) { /* cookie name */ + else if (strcmp(args[0], "cookie") == 0) { /* cookie name */ int cur_arg; if (warnifnotcap(curproxy, PR_CAP_BE, file, linenum, args[0], NULL)) @@ -868,34 +868,34 @@ int cfg_parse_listen(const char *file, int linenum, char **args, int kwm) cur_arg = 2; while (*(args[cur_arg])) { - if (!strcmp(args[cur_arg], "rewrite")) { + if (strcmp(args[cur_arg], "rewrite") == 0) { curproxy->ck_opts |= PR_CK_RW; } - else if (!strcmp(args[cur_arg], "indirect")) { + else if (strcmp(args[cur_arg], "indirect") == 0) { curproxy->ck_opts |= PR_CK_IND; } - else if (!strcmp(args[cur_arg], "insert")) { + else if (strcmp(args[cur_arg], "insert") == 0) { curproxy->ck_opts |= PR_CK_INS; } - else if (!strcmp(args[cur_arg], "nocache")) { + else if (strcmp(args[cur_arg], "nocache") == 0) { curproxy->ck_opts |= PR_CK_NOC; } - else if (!strcmp(args[cur_arg], "postonly")) { + else if (strcmp(args[cur_arg], "postonly") == 0) { curproxy->ck_opts |= PR_CK_POST; } - else if (!strcmp(args[cur_arg], "preserve")) { + else if (strcmp(args[cur_arg], "preserve") == 0) { curproxy->ck_opts |= PR_CK_PSV; } - else if (!strcmp(args[cur_arg], "prefix")) { + else if (strcmp(args[cur_arg], "prefix") == 0) { curproxy->ck_opts |= PR_CK_PFX; } - else if (!strcmp(args[cur_arg], "httponly")) { + else if (strcmp(args[cur_arg], "httponly") == 0) { curproxy->ck_opts |= PR_CK_HTTPONLY; } - else if (!strcmp(args[cur_arg], "secure")) { + else if (strcmp(args[cur_arg], "secure") == 0) { curproxy->ck_opts |= PR_CK_SECURE; } - else if (!strcmp(args[cur_arg], "domain")) { + else if (strcmp(args[cur_arg], "domain") == 0) { if (!*args[cur_arg + 1]) { ha_alert("parsing [%s:%d]: '%s' expects as argument.\n", file, linenum, args[cur_arg]); @@ -936,7 +936,7 @@ int cfg_parse_listen(const char *file, int linenum, char **args, int kwm) } cur_arg++; } - else if (!strcmp(args[cur_arg], "maxidle")) { + else if (strcmp(args[cur_arg], "maxidle") == 0) { unsigned int maxidle; const char *res; @@ -969,7 +969,7 @@ int cfg_parse_listen(const char *file, int linenum, char **args, int kwm) curproxy->cookie_maxidle = maxidle; cur_arg++; } - else if (!strcmp(args[cur_arg], "maxlife")) { + else if (strcmp(args[cur_arg], "maxlife") == 0) { unsigned int maxlife; const char *res; @@ -1003,13 +1003,13 @@ int cfg_parse_listen(const char *file, int linenum, char **args, int kwm) curproxy->cookie_maxlife = maxlife; cur_arg++; } - else if (!strcmp(args[cur_arg], "dynamic")) { /* Dynamic persistent cookies secret key */ + else if (strcmp(args[cur_arg], "dynamic") == 0) { /* Dynamic persistent cookies secret key */ if (warnifnotcap(curproxy, PR_CAP_BE, file, linenum, args[cur_arg], NULL)) err_code |= ERR_WARN; curproxy->ck_opts |= PR_CK_DYNAMIC; } - else if (!strcmp(args[cur_arg], "attr")) { + else if (strcmp(args[cur_arg], "attr") == 0) { char *val; if (!*args[cur_arg + 1]) { ha_alert("parsing [%s:%d]: '%s' expects as argument.\n", @@ -1061,7 +1061,7 @@ int cfg_parse_listen(const char *file, int linenum, char **args, int kwm) err_code |= ERR_ALERT | ERR_FATAL; } }/* end else if (!strcmp(args[0], "cookie")) */ - else if (!strcmp(args[0], "email-alert")) { + else if (strcmp(args[0], "email-alert") == 0) { if (*(args[1]) == 0) { ha_alert("parsing [%s:%d] : missing argument after '%s'.\n", file, linenum, args[0]); @@ -1069,7 +1069,7 @@ int cfg_parse_listen(const char *file, int linenum, char **args, int kwm) goto out; } - if (!strcmp(args[1], "from")) { + if (strcmp(args[1], "from") == 0) { if (*(args[1]) == 0) { ha_alert("parsing [%s:%d] : missing argument after '%s'.\n", file, linenum, args[1]); @@ -1079,7 +1079,7 @@ int cfg_parse_listen(const char *file, int linenum, char **args, int kwm) free(curproxy->email_alert.from); curproxy->email_alert.from = strdup(args[2]); } - else if (!strcmp(args[1], "mailers")) { + else if (strcmp(args[1], "mailers") == 0) { if (*(args[1]) == 0) { ha_alert("parsing [%s:%d] : missing argument after '%s'.\n", file, linenum, args[1]); @@ -1089,7 +1089,7 @@ int cfg_parse_listen(const char *file, int linenum, char **args, int kwm) free(curproxy->email_alert.mailers.name); curproxy->email_alert.mailers.name = strdup(args[2]); } - else if (!strcmp(args[1], "myhostname")) { + else if (strcmp(args[1], "myhostname") == 0) { if (*(args[1]) == 0) { ha_alert("parsing [%s:%d] : missing argument after '%s'.\n", file, linenum, args[1]); @@ -1099,7 +1099,7 @@ int cfg_parse_listen(const char *file, int linenum, char **args, int kwm) free(curproxy->email_alert.myhostname); curproxy->email_alert.myhostname = strdup(args[2]); } - else if (!strcmp(args[1], "level")) { + else if (strcmp(args[1], "level") == 0) { curproxy->email_alert.level = get_log_level(args[2]); if (curproxy->email_alert.level < 0) { ha_alert("parsing [%s:%d] : unknown log level '%s' after '%s'\n", @@ -1108,7 +1108,7 @@ int cfg_parse_listen(const char *file, int linenum, char **args, int kwm) goto out; } } - else if (!strcmp(args[1], "to")) { + else if (strcmp(args[1], "to") == 0) { if (*(args[1]) == 0) { ha_alert("parsing [%s:%d] : missing argument after '%s'.\n", file, linenum, args[1]); @@ -1127,7 +1127,7 @@ int cfg_parse_listen(const char *file, int linenum, char **args, int kwm) /* Indicate that the email_alert is at least partially configured */ curproxy->email_alert.set = 1; }/* end else if (!strcmp(args[0], "email-alert")) */ - else if (!strcmp(args[0], "persist")) { /* persist */ + else if (strcmp(args[0], "persist") == 0) { /* persist */ if (*(args[1]) == 0) { ha_alert("parsing [%s:%d] : missing persist method.\n", file, linenum); @@ -1177,21 +1177,21 @@ int cfg_parse_listen(const char *file, int linenum, char **args, int kwm) goto out; } } - else if (!strcmp(args[0], "appsession")) { /* cookie name */ + else if (strcmp(args[0], "appsession") == 0) { /* cookie name */ ha_alert("parsing [%s:%d] : '%s' is not supported anymore since HAProxy 1.6.\n", file, linenum, args[0]); err_code |= ERR_ALERT | ERR_FATAL; goto out; } - else if (!strcmp(args[0], "load-server-state-from-file")) { + else if (strcmp(args[0], "load-server-state-from-file") == 0) { if (warnifnotcap(curproxy, PR_CAP_BE, file, linenum, args[0], NULL)) err_code |= ERR_WARN; - if (!strcmp(args[1], "global")) { /* use the file pointed to by global server-state-file directive */ + if (strcmp(args[1], "global") == 0) { /* use the file pointed to by global server-state-file directive */ curproxy->load_server_state_from_file = PR_SRV_STATE_FILE_GLOBAL; } - else if (!strcmp(args[1], "local")) { /* use the server-state-file-name variable to locate the server-state file */ + else if (strcmp(args[1], "local") == 0) { /* use the server-state-file-name variable to locate the server-state file */ curproxy->load_server_state_from_file = PR_SRV_STATE_FILE_LOCAL; } - else if (!strcmp(args[1], "none")) { /* don't use server-state-file directive for this backend */ + else if (strcmp(args[1], "none") == 0) { /* don't use server-state-file directive for this backend */ curproxy->load_server_state_from_file = PR_SRV_STATE_FILE_NONE; } else { @@ -1201,7 +1201,7 @@ int cfg_parse_listen(const char *file, int linenum, char **args, int kwm) goto out; } } - else if (!strcmp(args[0], "server-state-file-name")) { + else if (strcmp(args[0], "server-state-file-name") == 0) { if (warnifnotcap(curproxy, PR_CAP_BE, file, linenum, args[0], NULL)) err_code |= ERR_WARN; if (*(args[1]) == 0) { @@ -1210,12 +1210,12 @@ int cfg_parse_listen(const char *file, int linenum, char **args, int kwm) err_code |= ERR_ALERT | ERR_FATAL; goto out; } - else if (!strcmp(args[1], "use-backend-name")) + else if (strcmp(args[1], "use-backend-name") == 0) curproxy->server_state_file_name = strdup(curproxy->id); else curproxy->server_state_file_name = strdup(args[1]); } - else if (!strcmp(args[0], "max-session-srv-conns")) { + else if (strcmp(args[0], "max-session-srv-conns") == 0) { if (warnifnotcap(curproxy, PR_CAP_FE, file, linenum, args[0], NULL)) err_code |= ERR_WARN; if (*(args[1]) == 0) { @@ -1226,11 +1226,11 @@ int cfg_parse_listen(const char *file, int linenum, char **args, int kwm) } curproxy->max_out_conns = atoi(args[1]); } - else if (!strcmp(args[0], "capture")) { + else if (strcmp(args[0], "capture") == 0) { if (warnifnotcap(curproxy, PR_CAP_FE, file, linenum, args[0], NULL)) err_code |= ERR_WARN; - if (!strcmp(args[1], "cookie")) { /* name of a cookie to capture */ + if (strcmp(args[1], "cookie") == 0) { /* name of a cookie to capture */ if (curproxy == &defproxy) { ha_alert("parsing [%s:%d] : '%s %s' not allowed in 'defaults' section.\n", file, linenum, args[0], args[1]); err_code |= ERR_ALERT | ERR_FATAL; @@ -1252,7 +1252,7 @@ int cfg_parse_listen(const char *file, int linenum, char **args, int kwm) curproxy->capture_len = atol(args[4]); curproxy->to_log |= LW_COOKIE; } - else if (!strcmp(args[1], "request") && !strcmp(args[2], "header")) { + else if (strcmp(args[1], "request") == 0 && strcmp(args[2], "header") == 0) { struct cap_hdr *hdr; if (curproxy == &defproxy) { @@ -1281,7 +1281,7 @@ int cfg_parse_listen(const char *file, int linenum, char **args, int kwm) curproxy->req_cap = hdr; curproxy->to_log |= LW_REQHDR; } - else if (!strcmp(args[1], "response") && !strcmp(args[2], "header")) { + else if (strcmp(args[1], "response") == 0 && strcmp(args[2], "header") == 0) { struct cap_hdr *hdr; if (curproxy == &defproxy) { @@ -1316,7 +1316,7 @@ int cfg_parse_listen(const char *file, int linenum, char **args, int kwm) goto out; } } - else if (!strcmp(args[0], "retries")) { /* connection retries */ + else if (strcmp(args[0], "retries") == 0) { /* connection retries */ if (warnifnotcap(curproxy, PR_CAP_BE, file, linenum, args[0], NULL)) err_code |= ERR_WARN; @@ -1331,7 +1331,7 @@ int cfg_parse_listen(const char *file, int linenum, char **args, int kwm) } curproxy->conn_retries = atol(args[1]); } - else if (!strcmp(args[0], "http-request")) { /* request access control: allow/deny/auth */ + else if (strcmp(args[0], "http-request") == 0) { /* request access control: allow/deny/auth */ struct act_rule *rule; if (curproxy == &defproxy) { @@ -1362,7 +1362,7 @@ int cfg_parse_listen(const char *file, int linenum, char **args, int kwm) LIST_ADDQ(&curproxy->http_req_rules, &rule->list); } - else if (!strcmp(args[0], "http-response")) { /* response access control */ + else if (strcmp(args[0], "http-response") == 0) { /* response access control */ struct act_rule *rule; if (curproxy == &defproxy) { @@ -1392,7 +1392,7 @@ int cfg_parse_listen(const char *file, int linenum, char **args, int kwm) LIST_ADDQ(&curproxy->http_res_rules, &rule->list); } - else if (!strcmp(args[0], "http-after-response")) { + else if (strcmp(args[0], "http-after-response") == 0) { struct act_rule *rule; if (curproxy == &defproxy) { @@ -1422,7 +1422,7 @@ int cfg_parse_listen(const char *file, int linenum, char **args, int kwm) LIST_ADDQ(&curproxy->http_after_res_rules, &rule->list); } - else if (!strcmp(args[0], "http-send-name-header")) { /* send server name in request header */ + else if (strcmp(args[0], "http-send-name-header") == 0) { /* send server name in request header */ /* set the header name and length into the proxy structure */ if (warnifnotcap(curproxy, PR_CAP_BE, file, linenum, args[0], NULL)) err_code |= ERR_WARN; @@ -1440,13 +1440,13 @@ int cfg_parse_listen(const char *file, int linenum, char **args, int kwm) curproxy->server_id_hdr_len = strlen(curproxy->server_id_hdr_name); ist2bin_lc(curproxy->server_id_hdr_name, ist2(curproxy->server_id_hdr_name, curproxy->server_id_hdr_len)); } - else if (!strcmp(args[0], "block")) { + else if (strcmp(args[0], "block") == 0) { ha_alert("parsing [%s:%d] : The '%s' directive is not supported anymore since HAProxy 2.1. Use 'http-request deny' which uses the exact same syntax.\n", file, linenum, args[0]); err_code |= ERR_ALERT | ERR_FATAL; goto out; } - else if (!strcmp(args[0], "redirect")) { + else if (strcmp(args[0], "redirect") == 0) { struct redirect_rule *rule; if (curproxy == &defproxy) { @@ -1468,7 +1468,7 @@ int cfg_parse_listen(const char *file, int linenum, char **args, int kwm) (curproxy->cap & PR_CAP_FE) ? SMP_VAL_FE_HRQ_HDR : SMP_VAL_BE_HRQ_HDR, file, linenum); } - else if (!strcmp(args[0], "use_backend")) { + else if (strcmp(args[0], "use_backend") == 0) { struct switching_rule *rule; if (curproxy == &defproxy) { @@ -1562,8 +1562,8 @@ int cfg_parse_listen(const char *file, int linenum, char **args, int kwm) LIST_ADDQ(&curproxy->server_rules, &rule->list); curproxy->be_req_ana |= AN_REQ_SRV_RULES; } - else if ((!strcmp(args[0], "force-persist")) || - (!strcmp(args[0], "ignore-persist"))) { + else if ((strcmp(args[0], "force-persist") == 0) || + (strcmp(args[0], "ignore-persist") == 0)) { struct persist_rule *rule; if (curproxy == &defproxy) { @@ -1596,7 +1596,7 @@ int cfg_parse_listen(const char *file, int linenum, char **args, int kwm) rule = calloc(1, sizeof(*rule)); rule->cond = cond; - if (!strcmp(args[0], "force-persist")) { + if (strcmp(args[0], "force-persist") == 0) { rule->type = PERSIST_TYPE_FORCE; } else { rule->type = PERSIST_TYPE_IGNORE; @@ -1604,7 +1604,7 @@ int cfg_parse_listen(const char *file, int linenum, char **args, int kwm) LIST_INIT(&rule->list); LIST_ADDQ(&curproxy->persist_rules, &rule->list); } - else if (!strcmp(args[0], "stick-table")) { + else if (strcmp(args[0], "stick-table") == 0) { struct stktable *other; if (curproxy == &defproxy) { @@ -1651,7 +1651,7 @@ int cfg_parse_listen(const char *file, int linenum, char **args, int kwm) curproxy->table->proxies_list = curproxy; } } - else if (!strcmp(args[0], "stick")) { + else if (strcmp(args[0], "stick") == 0) { struct sticking_rule *rule; struct sample_expr *expr; int myidx = 0; @@ -1765,13 +1765,13 @@ int cfg_parse_listen(const char *file, int linenum, char **args, int kwm) else LIST_ADDQ(&curproxy->sticking_rules, &rule->list); } - else if (!strcmp(args[0], "stats")) { + else if (strcmp(args[0], "stats") == 0) { if (curproxy != &defproxy && curproxy->uri_auth == defproxy.uri_auth) curproxy->uri_auth = NULL; /* we must detach from the default config */ if (!*args[1]) { goto stats_error_parsing; - } else if (!strcmp(args[1], "admin")) { + } else if (strcmp(args[1], "admin") == 0) { struct stats_admin_rule *rule; if (curproxy == &defproxy) { @@ -1807,7 +1807,7 @@ int cfg_parse_listen(const char *file, int linenum, char **args, int kwm) rule->cond = cond; LIST_INIT(&rule->list); LIST_ADDQ(&curproxy->uri_auth->admin_rules, &rule->list); - } else if (!strcmp(args[1], "uri")) { + } else if (strcmp(args[1], "uri") == 0) { if (*(args[2]) == 0) { ha_alert("parsing [%s:%d] : 'uri' needs an URI prefix.\n", file, linenum); err_code |= ERR_ALERT | ERR_FATAL; @@ -1817,7 +1817,7 @@ int cfg_parse_listen(const char *file, int linenum, char **args, int kwm) err_code |= ERR_ALERT | ERR_ABORT; goto out; } - } else if (!strcmp(args[1], "realm")) { + } else if (strcmp(args[1], "realm") == 0) { if (*(args[2]) == 0) { ha_alert("parsing [%s:%d] : 'realm' needs an realm name.\n", file, linenum); err_code |= ERR_ALERT | ERR_FATAL; @@ -1827,7 +1827,7 @@ int cfg_parse_listen(const char *file, int linenum, char **args, int kwm) err_code |= ERR_ALERT | ERR_ABORT; goto out; } - } else if (!strcmp(args[1], "refresh")) { + } else if (strcmp(args[1], "refresh") == 0) { unsigned interval; err = parse_time_err(args[2], &interval, TIME_UNIT_S); @@ -1853,7 +1853,7 @@ int cfg_parse_listen(const char *file, int linenum, char **args, int kwm) err_code |= ERR_ALERT | ERR_ABORT; goto out; } - } else if (!strcmp(args[1], "http-request")) { /* request access control: allow/deny/auth */ + } else if (strcmp(args[1], "http-request") == 0) { /* request access control: allow/deny/auth */ struct act_rule *rule; if (curproxy == &defproxy) { @@ -1887,7 +1887,7 @@ int cfg_parse_listen(const char *file, int linenum, char **args, int kwm) file, linenum); LIST_ADDQ(&curproxy->uri_auth->http_req_rules, &rule->list); - } else if (!strcmp(args[1], "auth")) { + } else if (strcmp(args[1], "auth") == 0) { if (*(args[2]) == 0) { ha_alert("parsing [%s:%d] : 'auth' needs a user:password account.\n", file, linenum); err_code |= ERR_ALERT | ERR_FATAL; @@ -1897,7 +1897,7 @@ int cfg_parse_listen(const char *file, int linenum, char **args, int kwm) err_code |= ERR_ALERT | ERR_ABORT; goto out; } - } else if (!strcmp(args[1], "scope")) { + } else if (strcmp(args[1], "scope") == 0) { if (*(args[2]) == 0) { ha_alert("parsing [%s:%d] : 'scope' needs a proxy name.\n", file, linenum); err_code |= ERR_ALERT | ERR_FATAL; @@ -1907,31 +1907,31 @@ int cfg_parse_listen(const char *file, int linenum, char **args, int kwm) err_code |= ERR_ALERT | ERR_ABORT; goto out; } - } else if (!strcmp(args[1], "enable")) { + } else if (strcmp(args[1], "enable") == 0) { if (!stats_check_init_uri_auth(&curproxy->uri_auth)) { ha_alert("parsing [%s:%d] : out of memory.\n", file, linenum); err_code |= ERR_ALERT | ERR_ABORT; goto out; } - } else if (!strcmp(args[1], "hide-version")) { + } else if (strcmp(args[1], "hide-version") == 0) { if (!stats_set_flag(&curproxy->uri_auth, STAT_HIDEVER)) { ha_alert("parsing [%s:%d] : out of memory.\n", file, linenum); err_code |= ERR_ALERT | ERR_ABORT; goto out; } - } else if (!strcmp(args[1], "show-legends")) { + } else if (strcmp(args[1], "show-legends") == 0) { if (!stats_set_flag(&curproxy->uri_auth, STAT_SHLGNDS)) { ha_alert("parsing [%s:%d]: out of memory.\n", file, linenum); err_code |= ERR_ALERT | ERR_ABORT; goto out; } - } else if (!strcmp(args[1], "show-modules")) { + } else if (strcmp(args[1], "show-modules") == 0) { if (!stats_set_flag(&curproxy->uri_auth, STAT_SHMODULES)) { ha_alert("parsing [%s:%d]: out of memory.\n", file, linenum); err_code |= ERR_ALERT | ERR_ABORT; goto out; } - } else if (!strcmp(args[1], "show-node")) { + } else if (strcmp(args[1], "show-node") == 0) { if (*args[2]) { int i; @@ -1958,7 +1958,7 @@ int cfg_parse_listen(const char *file, int linenum, char **args, int kwm) err_code |= ERR_ALERT | ERR_ABORT; goto out; } - } else if (!strcmp(args[1], "show-desc")) { + } else if (strcmp(args[1], "show-desc") == 0) { char *desc = NULL; if (*args[2]) { @@ -1995,7 +1995,7 @@ stats_error_parsing: goto out; } } - else if (!strcmp(args[0], "option")) { + else if (strcmp(args[0], "option") == 0) { int optnum; if (*(args[1]) == '\0') { @@ -2006,7 +2006,7 @@ stats_error_parsing: } for (optnum = 0; cfg_opts[optnum].name; optnum++) { - if (!strcmp(args[1], cfg_opts[optnum].name)) { + if (strcmp(args[1], cfg_opts[optnum].name) == 0) { if (cfg_opts[optnum].cap == PR_CAP_NONE) { ha_alert("parsing [%s:%d]: option '%s' is not supported due to build options.\n", file, linenum, cfg_opts[optnum].name); @@ -2040,7 +2040,7 @@ stats_error_parsing: } for (optnum = 0; cfg_opts2[optnum].name; optnum++) { - if (!strcmp(args[1], cfg_opts2[optnum].name)) { + if (strcmp(args[1], cfg_opts2[optnum].name) == 0) { if (cfg_opts2[optnum].cap == PR_CAP_NONE) { ha_alert("parsing [%s:%d]: option '%s' is not supported due to build options.\n", file, linenum, cfg_opts2[optnum].name); @@ -2055,7 +2055,7 @@ stats_error_parsing: } /* "[no] option http-use-htx" is deprecated */ - if (!strcmp(cfg_opts2[optnum].name, "http-use-htx")) { + if (strcmp(cfg_opts2[optnum].name, "http-use-htx") == 0) { if (kwm ==KWM_NO) { ha_warning("parsing [%s:%d]: option '%s' is deprecated and ignored." " The HTX mode is now the only supported mode.\n", @@ -2180,12 +2180,12 @@ stats_error_parsing: goto out; } - if (!strcmp(args[1], "httplog")) { + if (strcmp(args[1], "httplog") == 0) { char *logformat; /* generate a complete HTTP log */ logformat = default_http_log_format; if (*(args[2]) != '\0') { - if (!strcmp(args[2], "clf")) { + if (strcmp(args[2], "clf") == 0) { curproxy->options2 |= PR_O2_CLFLOG; logformat = clf_http_log_format; } else { @@ -2227,7 +2227,7 @@ stats_error_parsing: err_code |= ERR_WARN; } } - else if (!strcmp(args[1], "tcplog")) { + else if (strcmp(args[1], "tcplog") == 0) { if (curproxy->conf.logformat_string && curproxy == &defproxy) { char *oldlogformat = "log-format"; @@ -2260,7 +2260,7 @@ stats_error_parsing: err_code |= ERR_WARN; } } - else if (!strcmp(args[1], "tcpka")) { + else if (strcmp(args[1], "tcpka") == 0) { /* enable TCP keep-alives on client and server streams */ if (warnifnotcap(curproxy, PR_CAP_BE | PR_CAP_FE, file, linenum, args[1], NULL)) err_code |= ERR_WARN; @@ -2273,57 +2273,57 @@ stats_error_parsing: if (curproxy->cap & PR_CAP_BE) curproxy->options |= PR_O_TCP_SRV_KA; } - else if (!strcmp(args[1], "httpchk")) { + else if (strcmp(args[1], "httpchk") == 0) { err_code |= proxy_parse_httpchk_opt(args, 0, curproxy, &defproxy, file, linenum); if (err_code & ERR_FATAL) goto out; } - else if (!strcmp(args[1], "ssl-hello-chk")) { + else if (strcmp(args[1], "ssl-hello-chk") == 0) { err_code |= proxy_parse_ssl_hello_chk_opt(args, 0, curproxy, &defproxy, file, linenum); if (err_code & ERR_FATAL) goto out; } - else if (!strcmp(args[1], "smtpchk")) { + else if (strcmp(args[1], "smtpchk") == 0) { err_code |= proxy_parse_smtpchk_opt(args, 0, curproxy, &defproxy, file, linenum); if (err_code & ERR_FATAL) goto out; } - else if (!strcmp(args[1], "pgsql-check")) { + else if (strcmp(args[1], "pgsql-check") == 0) { err_code |= proxy_parse_pgsql_check_opt(args, 0, curproxy, &defproxy, file, linenum); if (err_code & ERR_FATAL) goto out; } - else if (!strcmp(args[1], "redis-check")) { + else if (strcmp(args[1], "redis-check") == 0) { err_code |= proxy_parse_redis_check_opt(args, 0, curproxy, &defproxy, file, linenum); if (err_code & ERR_FATAL) goto out; } - else if (!strcmp(args[1], "mysql-check")) { + else if (strcmp(args[1], "mysql-check") == 0) { err_code |= proxy_parse_mysql_check_opt(args, 0, curproxy, &defproxy, file, linenum); if (err_code & ERR_FATAL) goto out; } - else if (!strcmp(args[1], "ldap-check")) { + else if (strcmp(args[1], "ldap-check") == 0) { err_code |= proxy_parse_ldap_check_opt(args, 0, curproxy, &defproxy, file, linenum); if (err_code & ERR_FATAL) goto out; } - else if (!strcmp(args[1], "spop-check")) { + else if (strcmp(args[1], "spop-check") == 0) { err_code |= proxy_parse_spop_check_opt(args, 0, curproxy, &defproxy, file, linenum); if (err_code & ERR_FATAL) goto out; } - else if (!strcmp(args[1], "tcp-check")) { + else if (strcmp(args[1], "tcp-check") == 0) { err_code |= proxy_parse_tcp_check_opt(args, 0, curproxy, &defproxy, file, linenum); if (err_code & ERR_FATAL) goto out; } - else if (!strcmp(args[1], "external-check")) { + else if (strcmp(args[1], "external-check") == 0) { err_code |= proxy_parse_external_check_opt(args, 0, curproxy, &defproxy, file, linenum); if (err_code & ERR_FATAL) goto out; } - else if (!strcmp(args[1], "forwardfor")) { + else if (strcmp(args[1], "forwardfor") == 0) { int cur_arg; /* insert x-forwarded-for field, but not for the IP address listed as an except. @@ -2339,7 +2339,7 @@ stats_error_parsing: /* loop to go through arguments - start at 2, since 0+1 = "option" "forwardfor" */ cur_arg = 2; while (*(args[cur_arg])) { - if (!strcmp(args[cur_arg], "except")) { + if (strcmp(args[cur_arg], "except") == 0) { /* suboption except - needs additional argument for it */ if (!*(args[cur_arg+1]) || !str2net(args[cur_arg+1], 1, &curproxy->except_net, &curproxy->except_mask)) { ha_alert("parsing [%s:%d] : '%s %s %s' expects
[/mask] as argument.\n", @@ -2350,7 +2350,7 @@ stats_error_parsing: /* flush useless bits */ curproxy->except_net.s_addr &= curproxy->except_mask.s_addr; cur_arg += 2; - } else if (!strcmp(args[cur_arg], "header")) { + } else if (strcmp(args[cur_arg], "header") == 0) { /* suboption header - needs additional argument for it */ if (*(args[cur_arg+1]) == 0) { ha_alert("parsing [%s:%d] : '%s %s %s' expects as argument.\n", @@ -2362,7 +2362,7 @@ stats_error_parsing: curproxy->fwdfor_hdr_name = strdup(args[cur_arg+1]); curproxy->fwdfor_hdr_len = strlen(curproxy->fwdfor_hdr_name); cur_arg += 2; - } else if (!strcmp(args[cur_arg], "if-none")) { + } else if (strcmp(args[cur_arg], "if-none") == 0) { curproxy->options &= ~PR_O_FF_ALWAYS; cur_arg += 1; } else { @@ -2374,7 +2374,7 @@ stats_error_parsing: } } /* end while loop */ } - else if (!strcmp(args[1], "originalto")) { + else if (strcmp(args[1], "originalto") == 0) { int cur_arg; /* insert x-original-to field, but not for the IP address listed as an except. @@ -2390,7 +2390,7 @@ stats_error_parsing: /* loop to go through arguments - start at 2, since 0+1 = "option" "originalto" */ cur_arg = 2; while (*(args[cur_arg])) { - if (!strcmp(args[cur_arg], "except")) { + if (strcmp(args[cur_arg], "except") == 0) { /* suboption except - needs additional argument for it */ if (!*(args[cur_arg+1]) || !str2net(args[cur_arg+1], 1, &curproxy->except_to, &curproxy->except_mask_to)) { ha_alert("parsing [%s:%d] : '%s %s %s' expects
[/mask] as argument.\n", @@ -2401,7 +2401,7 @@ stats_error_parsing: /* flush useless bits */ curproxy->except_to.s_addr &= curproxy->except_mask_to.s_addr; cur_arg += 2; - } else if (!strcmp(args[cur_arg], "header")) { + } else if (strcmp(args[cur_arg], "header") == 0) { /* suboption header - needs additional argument for it */ if (*(args[cur_arg+1]) == 0) { ha_alert("parsing [%s:%d] : '%s %s %s' expects as argument.\n", @@ -2429,7 +2429,7 @@ stats_error_parsing: } goto out; } - else if (!strcmp(args[0], "default_backend")) { + else if (strcmp(args[0], "default_backend") == 0) { if (warnifnotcap(curproxy, PR_CAP_FE, file, linenum, args[0], NULL)) err_code |= ERR_WARN; @@ -2444,13 +2444,13 @@ stats_error_parsing: if (alertif_too_many_args_idx(1, 0, file, linenum, args, &err_code)) goto out; } - else if (!strcmp(args[0], "redispatch") || !strcmp(args[0], "redisp")) { + else if (strcmp(args[0], "redispatch") == 0 || strcmp(args[0], "redisp") == 0) { ha_alert("parsing [%s:%d] : keyword '%s' directive is not supported anymore since HAProxy 2.1. Use 'option redispatch'.\n", file, linenum, args[0]); err_code |= ERR_ALERT | ERR_FATAL; goto out; } - else if (!strcmp(args[0], "http-reuse")) { + else if (strcmp(args[0], "http-reuse") == 0) { if (warnifnotcap(curproxy, PR_CAP_BE, file, linenum, args[0], NULL)) err_code |= ERR_WARN; @@ -2487,7 +2487,7 @@ stats_error_parsing: goto out; } } - else if (!strcmp(args[0], "monitor")) { + else if (strcmp(args[0], "monitor") == 0) { if (curproxy == &defproxy) { ha_alert("parsing [%s:%d] : '%s' not allowed in 'defaults' section.\n", file, linenum, args[0]); err_code |= ERR_ALERT | ERR_FATAL; @@ -2522,14 +2522,14 @@ stats_error_parsing: } } #ifdef USE_TPROXY - else if (!strcmp(args[0], "transparent")) { + else if (strcmp(args[0], "transparent") == 0) { /* enable transparent proxy connections */ curproxy->options |= PR_O_TRANSP; if (alertif_too_many_args(0, file, linenum, args, &err_code)) goto out; } #endif - else if (!strcmp(args[0], "maxconn")) { /* maxconn */ + else if (strcmp(args[0], "maxconn") == 0) { /* maxconn */ if (warnifnotcap(curproxy, PR_CAP_FE, file, linenum, args[0], " Maybe you want 'fullconn' instead ?")) err_code |= ERR_WARN; @@ -2542,7 +2542,7 @@ stats_error_parsing: if (alertif_too_many_args(1, file, linenum, args, &err_code)) goto out; } - else if (!strcmp(args[0], "backlog")) { /* backlog */ + else if (strcmp(args[0], "backlog") == 0) { /* backlog */ if (warnifnotcap(curproxy, PR_CAP_FE, file, linenum, args[0], NULL)) err_code |= ERR_WARN; @@ -2555,7 +2555,7 @@ stats_error_parsing: if (alertif_too_many_args(1, file, linenum, args, &err_code)) goto out; } - else if (!strcmp(args[0], "fullconn")) { /* fullconn */ + else if (strcmp(args[0], "fullconn") == 0) { /* fullconn */ if (warnifnotcap(curproxy, PR_CAP_BE, file, linenum, args[0], " Maybe you want 'maxconn' instead ?")) err_code |= ERR_WARN; @@ -2568,7 +2568,7 @@ stats_error_parsing: if (alertif_too_many_args(1, file, linenum, args, &err_code)) goto out; } - else if (!strcmp(args[0], "grace")) { /* grace time (ms) */ + else if (strcmp(args[0], "grace") == 0) { /* grace time (ms) */ if (*(args[1]) == 0) { ha_alert("parsing [%s:%d] : '%s' expects a time in milliseconds.\n", file, linenum, args[0]); err_code |= ERR_ALERT | ERR_FATAL; @@ -2600,7 +2600,7 @@ stats_error_parsing: ha_warning("parsing [%s:%d]: the '%s' is deprecated and will be removed in a future version.\n", file, linenum, args[0]); } - else if (!strcmp(args[0], "dispatch")) { /* dispatch address */ + else if (strcmp(args[0], "dispatch") == 0) { /* dispatch address */ struct sockaddr_storage *sk; int port1, port2; @@ -2627,7 +2627,7 @@ stats_error_parsing: curproxy->dispatch_addr = *sk; curproxy->options |= PR_O_DISPATCH; } - else if (!strcmp(args[0], "balance")) { /* set balancing with optional algorithm */ + else if (strcmp(args[0], "balance") == 0) { /* set balancing with optional algorithm */ if (warnifnotcap(curproxy, PR_CAP_BE, file, linenum, args[0], NULL)) err_code |= ERR_WARN; @@ -2637,7 +2637,7 @@ stats_error_parsing: goto out; } } - else if (!strcmp(args[0], "hash-type")) { /* set hashing method */ + else if (strcmp(args[0], "hash-type") == 0) { /* set hashing method */ /** * The syntax for hash-type config element is * hash-type {map-based|consistent} [[] avalanche] @@ -2676,16 +2676,16 @@ stats_error_parsing: curproxy->lbprm.algo |= BE_LB_HMOD_AVAL; } else { /* set the hash function */ - if (!strcmp(args[2], "sdbm")) { + if (strcmp(args[2], "sdbm") == 0) { curproxy->lbprm.algo |= BE_LB_HFCN_SDBM; } - else if (!strcmp(args[2], "djb2")) { + else if (strcmp(args[2], "djb2") == 0) { curproxy->lbprm.algo |= BE_LB_HFCN_DJB2; } - else if (!strcmp(args[2], "wt6")) { + else if (strcmp(args[2], "wt6") == 0) { curproxy->lbprm.algo |= BE_LB_HFCN_WT6; } - else if (!strcmp(args[2], "crc32")) { + else if (strcmp(args[2], "crc32") == 0) { curproxy->lbprm.algo |= BE_LB_HFCN_CRC32; } else { @@ -2695,7 +2695,7 @@ stats_error_parsing: } /* set the hash modifier */ - if (!strcmp(args[3], "avalanche")) { + if (strcmp(args[3], "avalanche") == 0) { curproxy->lbprm.algo |= BE_LB_HMOD_AVAL; } else if (*args[3]) { @@ -2797,7 +2797,7 @@ stats_error_parsing: err_code |= ERR_WARN; } } - else if (!strcmp(args[0], "log-format-sd")) { + else if (strcmp(args[0], "log-format-sd") == 0) { if (!*(args[1])) { ha_alert("parsing [%s:%d] : %s expects an argument.\n", file, linenum, args[0]); err_code |= ERR_ALERT | ERR_FATAL; @@ -2826,7 +2826,7 @@ stats_error_parsing: err_code |= ERR_WARN; } } - else if (!strcmp(args[0], "log-tag")) { /* tag to report to syslog */ + else if (strcmp(args[0], "log-tag") == 0) { /* tag to report to syslog */ if (*(args[1]) == 0) { ha_alert("parsing [%s:%d] : '%s' expects a tag for use in syslog.\n", file, linenum, args[0]); err_code |= ERR_ALERT | ERR_FATAL; @@ -2841,14 +2841,14 @@ stats_error_parsing: goto out; } } - else if (!strcmp(args[0], "log")) { /* "no log" or "log ..." */ + else if (strcmp(args[0], "log") == 0) { /* "no log" or "log ..." */ if (!parse_logsrv(args, &curproxy->logsrvs, (kwm == KWM_NO), &errmsg)) { ha_alert("parsing [%s:%d] : %s : %s\n", file, linenum, args[0], errmsg); err_code |= ERR_ALERT | ERR_FATAL; goto out; } } - else if (!strcmp(args[0], "source")) { /* address to which we bind when connecting */ + else if (strcmp(args[0], "source") == 0) { /* address to which we bind when connecting */ int cur_arg; int port1, port2; struct sockaddr_storage *sk; @@ -2883,7 +2883,7 @@ stats_error_parsing: cur_arg = 2; while (*(args[cur_arg])) { - if (!strcmp(args[cur_arg], "usesrc")) { /* address to use outside */ + if (strcmp(args[cur_arg], "usesrc") == 0) { /* address to use outside */ #if defined(CONFIG_HAP_TRANSPARENT) if (!*args[cur_arg + 1]) { ha_alert("parsing [%s:%d] : '%s' expects [:], 'client', or 'clientip' as argument.\n", @@ -2892,10 +2892,10 @@ stats_error_parsing: goto out; } - if (!strcmp(args[cur_arg + 1], "client")) { + if (strcmp(args[cur_arg + 1], "client") == 0) { curproxy->conn_src.opts &= ~CO_SRC_TPROXY_MASK; curproxy->conn_src.opts |= CO_SRC_TPROXY_CLI; - } else if (!strcmp(args[cur_arg + 1], "clientip")) { + } else if (strcmp(args[cur_arg + 1], "clientip") == 0) { curproxy->conn_src.opts &= ~CO_SRC_TPROXY_MASK; curproxy->conn_src.opts |= CO_SRC_TPROXY_CIP; } else if (!strncmp(args[cur_arg + 1], "hdr_ip(", 7)) { @@ -2963,7 +2963,7 @@ stats_error_parsing: continue; } - if (!strcmp(args[cur_arg], "interface")) { /* specifically bind to this interface */ + if (strcmp(args[cur_arg], "interface") == 0) { /* specifically bind to this interface */ #ifdef SO_BINDTODEVICE if (!*args[cur_arg + 1]) { ha_alert("parsing [%s:%d] : '%s' : missing interface name.\n", @@ -2990,126 +2990,126 @@ stats_error_parsing: goto out; } } - else if (!strcmp(args[0], "usesrc")) { /* address to use outside: needs "source" first */ + else if (strcmp(args[0], "usesrc") == 0) { /* address to use outside: needs "source" first */ ha_alert("parsing [%s:%d] : '%s' only allowed after a '%s' statement.\n", file, linenum, "usesrc", "source"); err_code |= ERR_ALERT | ERR_FATAL; goto out; } - else if (!strcmp(args[0], "cliexp") || !strcmp(args[0], "reqrep")) { /* replace request header from a regex */ + else if (strcmp(args[0], "cliexp") == 0 || strcmp(args[0], "reqrep") == 0) { /* replace request header from a regex */ ha_alert("parsing [%s:%d] : The '%s' directive is not supported anymore since HAProxy 2.1. " "Use 'http-request replace-path', 'http-request replace-uri' or 'http-request replace-header' instead.\n", file, linenum, args[0]); err_code |= ERR_ALERT | ERR_FATAL; goto out; } - else if (!strcmp(args[0], "reqdel")) { /* delete request header from a regex */ + else if (strcmp(args[0], "reqdel") == 0) { /* delete request header from a regex */ ha_alert("parsing [%s:%d] : The '%s' directive is not supported anymore since HAProxy 2.1. " "Use 'http-request del-header' instead.\n", file, linenum, args[0]); err_code |= ERR_ALERT | ERR_FATAL; goto out; } - else if (!strcmp(args[0], "reqdeny")) { /* deny a request if a header matches this regex */ + else if (strcmp(args[0], "reqdeny") == 0) { /* deny a request if a header matches this regex */ ha_alert("parsing [%s:%d] : The '%s' not supported anymore since HAProxy 2.1. " "Use 'http-request deny' instead.\n", file, linenum, args[0]); err_code |= ERR_ALERT | ERR_FATAL; goto out; } - else if (!strcmp(args[0], "reqpass")) { /* pass this header without allowing or denying the request */ + else if (strcmp(args[0], "reqpass") == 0) { /* pass this header without allowing or denying the request */ ha_alert("parsing [%s:%d] : The '%s' not supported anymore since HAProxy 2.1.\n", file, linenum, args[0]); err_code |= ERR_ALERT | ERR_FATAL; goto out; } - else if (!strcmp(args[0], "reqallow")) { /* allow a request if a header matches this regex */ + else if (strcmp(args[0], "reqallow") == 0) { /* allow a request if a header matches this regex */ ha_alert("parsing [%s:%d] : The '%s' directive is not supported anymore since HAProxy 2.1. " "Use 'http-request allow' instead.\n", file, linenum, args[0]); err_code |= ERR_ALERT | ERR_FATAL; goto out; } - else if (!strcmp(args[0], "reqtarpit")) { /* tarpit a request if a header matches this regex */ + else if (strcmp(args[0], "reqtarpit") == 0) { /* tarpit a request if a header matches this regex */ ha_alert("parsing [%s:%d] : The '%s' directive is not supported anymore since HAProxy 2.1. " "Use 'http-request tarpit' instead.\n", file, linenum, args[0]); err_code |= ERR_ALERT | ERR_FATAL; goto out; } - else if (!strcmp(args[0], "reqirep")) { /* replace request header from a regex, ignoring case */ + else if (strcmp(args[0], "reqirep") == 0) { /* replace request header from a regex, ignoring case */ ha_alert("parsing [%s:%d] : The '%s' directive is not supported anymore since HAProxy 2.1. " "Use 'http-request replace-header' instead.\n", file, linenum, args[0]); err_code |= ERR_ALERT | ERR_FATAL; goto out; } - else if (!strcmp(args[0], "reqidel")) { /* delete request header from a regex ignoring case */ + else if (strcmp(args[0], "reqidel") == 0) { /* delete request header from a regex ignoring case */ ha_alert("parsing [%s:%d] : The '%s' directive is not supported anymore since HAProxy 2.1. " "Use 'http-request del-header' instead.\n", file, linenum, args[0]); err_code |= ERR_ALERT | ERR_FATAL; goto out; } - else if (!strcmp(args[0], "reqideny")) { /* deny a request if a header matches this regex ignoring case */ + else if (strcmp(args[0], "reqideny") == 0) { /* deny a request if a header matches this regex ignoring case */ ha_alert("parsing [%s:%d] : The '%s' directive is not supported anymore since HAProxy 2.1. " "Use 'http-request deny' instead.\n", file, linenum, args[0]); err_code |= ERR_ALERT | ERR_FATAL; goto out; } - else if (!strcmp(args[0], "reqipass")) { /* pass this header without allowing or denying the request */ + else if (strcmp(args[0], "reqipass") == 0) { /* pass this header without allowing or denying the request */ ha_alert("parsing [%s:%d] : The '%s' directive is not supported anymore since HAProxy 2.1.\n", file, linenum, args[0]); err_code |= ERR_ALERT | ERR_FATAL; goto out; } - else if (!strcmp(args[0], "reqiallow")) { /* allow a request if a header matches this regex ignoring case */ + else if (strcmp(args[0], "reqiallow") == 0) { /* allow a request if a header matches this regex ignoring case */ ha_alert("parsing [%s:%d] : The '%s' directive is not supported anymore since HAProxy 2.1. " "Use 'http-request allow' instead.\n", file, linenum, args[0]); err_code |= ERR_ALERT | ERR_FATAL; goto out; } - else if (!strcmp(args[0], "reqitarpit")) { /* tarpit a request if a header matches this regex ignoring case */ + else if (strcmp(args[0], "reqitarpit") == 0) { /* tarpit a request if a header matches this regex ignoring case */ ha_alert("parsing [%s:%d] : The '%s' directive is not supported anymore since HAProxy 2.1. " "Use 'http-request tarpit' instead.\n", file, linenum, args[0]); err_code |= ERR_ALERT | ERR_FATAL; goto out; } - else if (!strcmp(args[0], "reqadd")) { /* add request header */ + else if (strcmp(args[0], "reqadd") == 0) { /* add request header */ ha_alert("parsing [%s:%d] : The '%s' directive is not supported anymore since HAProxy 2.1. " "Use 'http-request add-header' instead.\n", file, linenum, args[0]); err_code |= ERR_ALERT | ERR_FATAL; goto out; } - else if (!strcmp(args[0], "srvexp") || !strcmp(args[0], "rsprep")) { /* replace response header from a regex */ + else if (strcmp(args[0], "srvexp") == 0 || strcmp(args[0], "rsprep") == 0) { /* replace response header from a regex */ ha_alert("parsing [%s:%d] : The '%s' directive is not supported anymore since HAProxy 2.1. " "Use 'http-response replace-header' instead.\n", file, linenum, args[0]); err_code |= ERR_ALERT | ERR_FATAL; goto out; } - else if (!strcmp(args[0], "rspdel")) { /* delete response header from a regex */ + else if (strcmp(args[0], "rspdel") == 0) { /* delete response header from a regex */ ha_alert("parsing [%s:%d] : The '%s' directive is not supported anymore since HAProxy 2.1. " "Use 'http-response del-header' .\n", file, linenum, args[0]); err_code |= ERR_ALERT | ERR_FATAL; goto out; } - else if (!strcmp(args[0], "rspdeny")) { /* block response header from a regex */ + else if (strcmp(args[0], "rspdeny") == 0) { /* block response header from a regex */ ha_alert("parsing [%s:%d] : The '%s' directive is not supported anymore since HAProxy 2.1. " "Use 'http-response deny' instead.\n", file, linenum, args[0]); err_code |= ERR_ALERT | ERR_FATAL; goto out; } - else if (!strcmp(args[0], "rspirep")) { /* replace response header from a regex ignoring case */ + else if (strcmp(args[0], "rspirep") == 0) { /* replace response header from a regex ignoring case */ ha_alert("parsing [%s:%d] : The '%s' directive is not supported anymore since HAProxy 2.1. " "Use 'http-response replace-header' instead.\n", file, linenum, args[0]); err_code |= ERR_ALERT | ERR_FATAL; goto out; } - else if (!strcmp(args[0], "rspidel")) { /* delete response header from a regex ignoring case */ + else if (strcmp(args[0], "rspidel") == 0) { /* delete response header from a regex ignoring case */ ha_alert("parsing [%s:%d] : The '%s' directive is not supported anymore since HAProxy 2.1. " "Use 'http-response del-header' instead.\n", file, linenum, args[0]); err_code |= ERR_ALERT | ERR_FATAL; goto out; } - else if (!strcmp(args[0], "rspideny")) { /* block response header from a regex ignoring case */ + else if (strcmp(args[0], "rspideny") == 0) { /* block response header from a regex ignoring case */ ha_alert("parsing [%s:%d] : The '%s' directive is not supported anymore since HAProxy 2.1. " "Use 'http-response deny' instead.\n", file, linenum, args[0]); err_code |= ERR_ALERT | ERR_FATAL; goto out; } - else if (!strcmp(args[0], "rspadd")) { /* add response header */ + else if (strcmp(args[0], "rspadd") == 0) { /* add response header */ ha_alert("parsing [%s:%d] : The '%s' directive is not supported anymore since HAProxy 2.1. " "Use 'http-response add-header' instead.\n", file, linenum, args[0]); err_code |= ERR_ALERT | ERR_FATAL; diff --git a/src/cfgparse-ssl.c b/src/cfgparse-ssl.c index 3d58cd22d9..ec7079ebd4 100644 --- a/src/cfgparse-ssl.c +++ b/src/cfgparse-ssl.c @@ -468,29 +468,29 @@ static int ssl_parse_global_extra_files(char **args, int section_type, struct pr for (i = 1; *args[i]; i++) { - if (!strcmp("bundle", args[i])) { + if (strcmp("bundle", args[i]) == 0) { gf |= SSL_GF_BUNDLE; - } else if (!strcmp("sctl", args[i])) { + } else if (strcmp("sctl", args[i]) == 0) { gf |= SSL_GF_SCTL; - } else if (!strcmp("ocsp", args[i])){ + } else if (strcmp("ocsp", args[i]) == 0){ gf |= SSL_GF_OCSP; - } else if (!strcmp("issuer", args[i])){ + } else if (strcmp("issuer", args[i]) == 0){ gf |= SSL_GF_OCSP_ISSUER; - } else if (!strcmp("key", args[i])) { + } else if (strcmp("key", args[i]) == 0) { gf |= SSL_GF_KEY; - } else if (!strcmp("none", args[i])) { + } else if (strcmp("none", args[i]) == 0) { if (gf != SSL_GF_NONE) goto err_alone; gf = SSL_GF_NONE; i++; break; - } else if (!strcmp("all", args[i])) { + } else if (strcmp("all", args[i]) == 0) { if (gf != SSL_GF_NONE) goto err_alone; gf = SSL_GF_ALL; @@ -790,15 +790,15 @@ static int parse_tls_method_options(char *arg, struct tls_version_filter *method if (!p) goto fail; p++; - if (!strcmp(p, "sslv3")) + if (strcmp(p, "sslv3") == 0) v = CONF_SSLV3; - else if (!strcmp(p, "tlsv10")) + else if (strcmp(p, "tlsv10") == 0) v = CONF_TLSV10; - else if (!strcmp(p, "tlsv11")) + else if (strcmp(p, "tlsv11") == 0) v = CONF_TLSV11; - else if (!strcmp(p, "tlsv12")) + else if (strcmp(p, "tlsv12") == 0) v = CONF_TLSV12; - else if (!strcmp(p, "tlsv13")) + else if (strcmp(p, "tlsv13") == 0) v = CONF_TLSV13; else goto fail; @@ -834,15 +834,15 @@ static int parse_tls_method_minmax(char **args, int cur_arg, struct tls_version_ return ERR_ALERT | ERR_FATAL; } for (i = CONF_TLSV_MIN; i <= CONF_TLSV_MAX; i++) - if (!strcmp(argv, methodVersions[i].name)) + if (strcmp(argv, methodVersions[i].name) == 0) v = i; if (!v) { memprintf(err, "'%s' : unknown ssl/tls version", args[cur_arg + 1]); return ERR_ALERT | ERR_FATAL; } - if (!strcmp("ssl-min-ver", args[cur_arg])) + if (strcmp("ssl-min-ver", args[cur_arg]) == 0) methods->min = v; - else if (!strcmp("ssl-max-ver", args[cur_arg])) + else if (strcmp("ssl-max-ver", args[cur_arg]) == 0) methods->max = v; else { memprintf(err, "'%s' : option not implemented", args[cur_arg]); @@ -1623,11 +1623,11 @@ static int ssl_parse_default_bind_options(char **args, int section_type, struct return -1; } while (*(args[i])) { - if (!strcmp(args[i], "no-tls-tickets")) + if (strcmp(args[i], "no-tls-tickets") == 0) global_ssl.listen_default_ssloptions |= BC_SSL_O_NO_TLS_TICKETS; - else if (!strcmp(args[i], "prefer-client-ciphers")) + else if (strcmp(args[i], "prefer-client-ciphers") == 0) global_ssl.listen_default_ssloptions |= BC_SSL_O_PREF_CLIE_CIPH; - else if (!strcmp(args[i], "ssl-min-ver") || !strcmp(args[i], "ssl-max-ver")) { + else if (strcmp(args[i], "ssl-min-ver") == 0 || strcmp(args[i], "ssl-max-ver") == 0) { if (!parse_tls_method_minmax(args, i, &global_ssl.listen_default_sslmethods, err)) i++; else { @@ -1655,9 +1655,9 @@ static int ssl_parse_default_server_options(char **args, int section_type, struc return -1; } while (*(args[i])) { - if (!strcmp(args[i], "no-tls-tickets")) + if (strcmp(args[i], "no-tls-tickets") == 0) global_ssl.connect_default_ssloptions |= SRV_SSL_O_NO_TLS_TICKETS; - else if (!strcmp(args[i], "ssl-min-ver") || !strcmp(args[i], "ssl-max-ver")) { + else if (strcmp(args[i], "ssl-min-ver") == 0 || strcmp(args[i], "ssl-max-ver") == 0) { if (!parse_tls_method_minmax(args, i, &global_ssl.connect_default_sslmethods, err)) i++; else { diff --git a/src/cfgparse.c b/src/cfgparse.c index a485a46708..c34b3a8f54 100644 --- a/src/cfgparse.c +++ b/src/cfgparse.c @@ -753,7 +753,7 @@ int cfg_parse_peers(const char *file, int linenum, char **args, int kwm) int local_peer, peer; peer = *args[0] == 'p'; - local_peer = !strcmp(args[1], localpeer); + local_peer = strcmp(args[1], localpeer) == 0; /* The local peer may have already partially been parsed on a "bind" line. */ if (*args[0] == 'p') { if (bind_line) { @@ -854,7 +854,7 @@ int cfg_parse_peers(const char *file, int linenum, char **args, int kwm) l->options |= LI_O_UNLIMITED; /* don't make the peers subject to global limits */ global.maxsock++; /* for the listening socket */ } - else if (!strcmp(args[0], "table")) { + else if (strcmp(args[0], "table") == 0) { struct stktable *t, *other; char *id; size_t prefix_len; @@ -917,10 +917,10 @@ int cfg_parse_peers(const char *file, int linenum, char **args, int kwm) t->next = stktables_list; stktables_list = t; } - else if (!strcmp(args[0], "disabled")) { /* disables this peers section */ + else if (strcmp(args[0], "disabled") == 0) { /* disables this peers section */ curpeers->disabled = 1; } - else if (!strcmp(args[0], "enabled")) { /* enables this peers section (used to revert a disabled default) */ + else if (strcmp(args[0], "enabled") == 0) { /* enables this peers section (used to revert a disabled default) */ curpeers->disabled = 0; } else if (*args[0] != 0) { @@ -1510,10 +1510,10 @@ cfg_parse_netns(const char *file, int linenum, char **args, int kwm) const char *err; const char *item = args[0]; - if (!strcmp(item, "namespace_list")) { + if (strcmp(item, "namespace_list") == 0) { return 0; } - else if (!strcmp(item, "namespace")) { + else if (strcmp(item, "namespace") == 0) { size_t idx = 1; const char *current; while (*(current = args[idx++])) { @@ -1552,7 +1552,7 @@ cfg_parse_users(const char *file, int linenum, char **args, int kwm) int err_code = 0; const char *err; - if (!strcmp(args[0], "userlist")) { /* new userlist */ + if (strcmp(args[0], "userlist") == 0) { /* new userlist */ struct userlist *newul; if (!*args[1]) { @@ -1573,7 +1573,7 @@ cfg_parse_users(const char *file, int linenum, char **args, int kwm) } for (newul = userlist; newul; newul = newul->next) - if (!strcmp(newul->name, args[1])) { + if (strcmp(newul->name, args[1]) == 0) { ha_warning("parsing [%s:%d]: ignoring duplicated userlist '%s'.\n", file, linenum, args[1]); err_code |= ERR_WARN; @@ -1598,7 +1598,7 @@ cfg_parse_users(const char *file, int linenum, char **args, int kwm) newul->next = userlist; userlist = newul; - } else if (!strcmp(args[0], "group")) { /* new group */ + } else if (strcmp(args[0], "group") == 0) { /* new group */ int cur_arg; const char *err; struct auth_groups *ag; @@ -1622,7 +1622,7 @@ cfg_parse_users(const char *file, int linenum, char **args, int kwm) goto out; for (ag = userlist->groups; ag; ag = ag->next) - if (!strcmp(ag->name, args[1])) { + if (strcmp(ag->name, args[1]) == 0) { ha_warning("parsing [%s:%d]: ignoring duplicated group '%s' in userlist '%s'.\n", file, linenum, args[1], userlist->name); err_code |= ERR_ALERT; @@ -1647,7 +1647,7 @@ cfg_parse_users(const char *file, int linenum, char **args, int kwm) cur_arg = 2; while (*args[cur_arg]) { - if (!strcmp(args[cur_arg], "users")) { + if (strcmp(args[cur_arg], "users") == 0) { ag->groupusers = strdup(args[cur_arg + 1]); cur_arg += 2; continue; @@ -1665,7 +1665,7 @@ cfg_parse_users(const char *file, int linenum, char **args, int kwm) ag->next = userlist->groups; userlist->groups = ag; - } else if (!strcmp(args[0], "user")) { /* new user */ + } else if (strcmp(args[0], "user") == 0) { /* new user */ struct auth_users *newuser; int cur_arg; @@ -1679,7 +1679,7 @@ cfg_parse_users(const char *file, int linenum, char **args, int kwm) goto out; for (newuser = userlist->users; newuser; newuser = newuser->next) - if (!strcmp(newuser->user, args[1])) { + if (strcmp(newuser->user, args[1]) == 0) { ha_warning("parsing [%s:%d]: ignoring duplicated user '%s' in userlist '%s'.\n", file, linenum, args[1], userlist->name); err_code |= ERR_ALERT; @@ -1701,7 +1701,7 @@ cfg_parse_users(const char *file, int linenum, char **args, int kwm) cur_arg = 2; while (*args[cur_arg]) { - if (!strcmp(args[cur_arg], "password")) { + if (strcmp(args[cur_arg], "password") == 0) { #ifdef USE_LIBCRYPT if (!crypt("", args[cur_arg + 1])) { ha_alert("parsing [%s:%d]: the encrypted password used for user '%s' is not supported by crypt(3).\n", @@ -1717,12 +1717,12 @@ cfg_parse_users(const char *file, int linenum, char **args, int kwm) newuser->pass = strdup(args[cur_arg + 1]); cur_arg += 2; continue; - } else if (!strcmp(args[cur_arg], "insecure-password")) { + } else if (strcmp(args[cur_arg], "insecure-password") == 0) { newuser->pass = strdup(args[cur_arg + 1]); newuser->flags |= AU_O_INSECURE; cur_arg += 2; continue; - } else if (!strcmp(args[cur_arg], "groups")) { + } else if (strcmp(args[cur_arg], "groups") == 0) { newuser->u.groups_names = strdup(args[cur_arg + 1]); cur_arg += 2; continue; @@ -2013,7 +2013,7 @@ next_line: continue; /* check for keyword modifiers "no" and "default" */ - if (!strcmp(args[0], "no")) { + if (strcmp(args[0], "no") == 0) { char *tmp; kwm = KWM_NO; @@ -2023,7 +2023,7 @@ next_line: *tmp = '\0'; // fix the next arg to \0 args[arg] = tmp; } - else if (!strcmp(args[0], "default")) { + else if (strcmp(args[0], "default") == 0) { kwm = KWM_DEF; for (arg=0; *args[arg+1]; arg++) args[arg] = args[arg+1]; // shift args after inversion @@ -2823,7 +2823,7 @@ int check_config_validity() struct mailers *curmailers = mailers; for (curmailers = mailers; curmailers; curmailers = curmailers->next) { - if (!strcmp(curmailers->id, curproxy->email_alert.mailers.name)) + if (strcmp(curmailers->id, curproxy->email_alert.mailers.name) == 0) break; } if (!curmailers) { diff --git a/src/cli.c b/src/cli.c index 8f6d382d73..c527e906d2 100644 --- a/src/cli.c +++ b/src/cli.c @@ -264,7 +264,7 @@ static int stats_parse_global(char **args, int section_type, struct proxy *curpx struct bind_conf *bind_conf; struct listener *l; - if (!strcmp(args[1], "socket")) { + if (strcmp(args[1], "socket") == 0) { int cur_arg; if (*args[2] == 0) { @@ -335,7 +335,7 @@ static int stats_parse_global(char **args, int section_type, struct proxy *curpx global.maxsock++; /* for the listening socket */ } } - else if (!strcmp(args[1], "timeout")) { + else if (strcmp(args[1], "timeout") == 0) { unsigned timeout; const char *res = parse_time_err(args[2], &timeout, TIME_UNIT_MS); @@ -366,7 +366,7 @@ static int stats_parse_global(char **args, int section_type, struct proxy *curpx } global.stats_fe->timeout.client = MS_TO_TICKS(timeout); } - else if (!strcmp(args[1], "maxconn")) { + else if (strcmp(args[1], "maxconn") == 0) { int maxconn = atol(args[2]); if (maxconn <= 0) { @@ -382,7 +382,7 @@ static int stats_parse_global(char **args, int section_type, struct proxy *curpx } global.stats_fe->maxconn = maxconn; } - else if (!strcmp(args[1], "bind-process")) { /* enable the socket only on some processes */ + else if (strcmp(args[1], "bind-process") == 0) { /* enable the socket only on some processes */ int cur_arg = 2; unsigned long set = 0; @@ -803,7 +803,7 @@ static void cli_io_handler(struct appctx *appctx) * Its location is not remembered here, this is just to switch * to a gathering mode. */ - if (!strcmp(appctx->chunk->area + appctx->chunk->data - strlen(PAYLOAD_PATTERN), PAYLOAD_PATTERN)) + if (strcmp(appctx->chunk->area + appctx->chunk->data - strlen(PAYLOAD_PATTERN), PAYLOAD_PATTERN) == 0) appctx->st1 |= APPCTX_CLI_ST1_PAYLOAD; else { /* no payload, the command is complete: parse the request */ @@ -1438,15 +1438,15 @@ static int cli_parse_set_maxconn_global(char **args, char *payload, struct appct static int set_severity_output(int *target, char *argument) { - if (!strcmp(argument, "none")) { + if (strcmp(argument, "none") == 0) { *target = CLI_SEVERITY_NONE; return 1; } - else if (!strcmp(argument, "number")) { + else if (strcmp(argument, "number") == 0) { *target = CLI_SEVERITY_NUMBER; return 1; } - else if (!strcmp(argument, "string")) { + else if (strcmp(argument, "string") == 0) { *target = CLI_SEVERITY_STRING; return 1; } @@ -1480,17 +1480,17 @@ static int cli_parse_show_lvl(char **args, char *payload, struct appctx *appctx, static int cli_parse_set_lvl(char **args, char *payload, struct appctx *appctx, void *private) { /* this will ask the applet to not output a \n after the command */ - if (!strcmp(args[1], "-")) + if (strcmp(args[1], "-") == 0) appctx->st1 |= APPCTX_CLI_ST1_NOLF; - if (!strcmp(args[0], "operator")) { + if (strcmp(args[0], "operator") == 0) { if (!cli_has_level(appctx, ACCESS_LVL_OPER)) { return 1; } appctx->cli_level &= ~ACCESS_LVL_MASK; appctx->cli_level |= ACCESS_LVL_OPER; - } else if (!strcmp(args[0], "user")) { + } else if (strcmp(args[0], "user") == 0) { if (!cli_has_level(appctx, ACCESS_LVL_USER)) { return 1; } @@ -1580,7 +1580,7 @@ static int bind_parse_expose_fd(char **args, int cur_arg, struct proxy *px, stru memprintf(err, "'%s' : missing fd type", args[cur_arg]); return ERR_ALERT | ERR_FATAL; } - if (!strcmp(args[cur_arg+1], "listeners")) { + if (strcmp(args[cur_arg + 1], "listeners") == 0) { conf->level |= ACCESS_FD_LISTENERS; } else { memprintf(err, "'%s' only supports 'listeners' (got '%s')", @@ -1599,13 +1599,13 @@ static int bind_parse_level(char **args, int cur_arg, struct proxy *px, struct b return ERR_ALERT | ERR_FATAL; } - if (!strcmp(args[cur_arg+1], "user")) { + if (strcmp(args[cur_arg + 1], "user") == 0) { conf->level &= ~ACCESS_LVL_MASK; conf->level |= ACCESS_LVL_USER; - } else if (!strcmp(args[cur_arg+1], "operator")) { + } else if (strcmp(args[cur_arg + 1], "operator") == 0) { conf->level &= ~ACCESS_LVL_MASK; conf->level |= ACCESS_LVL_OPER; - } else if (!strcmp(args[cur_arg+1], "admin")) { + } else if (strcmp(args[cur_arg + 1], "admin") == 0) { conf->level &= ~ACCESS_LVL_MASK; conf->level |= ACCESS_LVL_ADMIN; } else { @@ -1973,15 +1973,15 @@ int pcli_find_and_exec_kw(struct stream *s, char **args, int argl, char **errmsg else *next_pid = target_pid; return 1; - } else if (!strcmp("prompt", args[0])) { + } else if (strcmp("prompt", args[0]) == 0) { s->pcli_flags ^= PCLI_F_PROMPT; return argl; /* return the number of elements in the array */ - } else if (!strcmp("quit", args[0])) { + } else if (strcmp("quit", args[0]) == 0) { channel_shutr_now(&s->req); channel_shutw_now(&s->res); return argl; /* return the number of elements in the array */ - } else if (!strcmp(args[0], "operator")) { + } else if (strcmp(args[0], "operator") == 0) { if (!pcli_has_level(s, ACCESS_LVL_OPER)) { memprintf(errmsg, "Permission denied!\n"); return -1; @@ -1990,7 +1990,7 @@ int pcli_find_and_exec_kw(struct stream *s, char **args, int argl, char **errmsg s->pcli_flags |= ACCESS_LVL_OPER; return argl; - } else if (!strcmp(args[0], "user")) { + } else if (strcmp(args[0], "user") == 0) { if (!pcli_has_level(s, ACCESS_LVL_USER)) { memprintf(errmsg, "Permission denied!\n"); return -1; diff --git a/src/compression.c b/src/compression.c index e3f34b5654..785aa48239 100644 --- a/src/compression.c +++ b/src/compression.c @@ -131,7 +131,7 @@ int comp_append_algo(struct comp *comp, const char *algo) int i; for (i = 0; comp_algos[i].cfg_name; i++) { - if (!strcmp(algo, comp_algos[i].cfg_name)) { + if (strcmp(algo, comp_algos[i].cfg_name) == 0) { comp_algo = calloc(1, sizeof(*comp_algo)); memmove(comp_algo, &comp_algos[i], sizeof(struct comp_algo)); comp_algo->next = comp->algos; diff --git a/src/dns.c b/src/dns.c index 90efdad340..4f7ed4b501 100644 --- a/src/dns.c +++ b/src/dns.c @@ -137,7 +137,7 @@ struct dns_resolvers *find_resolvers_by_id(const char *id) struct dns_resolvers *res; list_for_each_entry(res, &dns_resolvers, list) { - if (!strcmp(res->id, id)) + if (strcmp(res->id, id) == 0) return res; } return NULL; @@ -164,7 +164,7 @@ struct dns_srvrq *find_srvrq_by_name(const char *name, struct proxy *px) struct dns_srvrq *srvrq; list_for_each_entry(srvrq, &dns_srvrq_list, list) { - if (srvrq->proxy == px && !strcmp(srvrq->name, name)) + if (srvrq->proxy == px && strcmp(srvrq->name, name) == 0) return srvrq; } return NULL; @@ -2499,7 +2499,7 @@ int dns_allocate_counters(struct list *stat_modules) mod->counters, mod->counters_size); /* Store the ns counters pointer */ - if (!strcmp(mod->name, "dns")) { + if (strcmp(mod->name, "dns") == 0) { ns->counters = (struct dns_counters *)ns->extra_counters->data + mod->counters_off[COUNTERS_DNS]; ns->counters->id = ns->id; } diff --git a/src/fcgi-app.c b/src/fcgi-app.c index 412584c660..0e7527b4b8 100644 --- a/src/fcgi-app.c +++ b/src/fcgi-app.c @@ -70,7 +70,7 @@ struct fcgi_app *fcgi_app_find_by_name(const char *name) struct fcgi_app *app; for (app = fcgi_apps; app != NULL; app = app->next) { - if (!strcmp(app->name, name)) + if (strcmp(app->name, name) == 0) return app; } @@ -544,7 +544,7 @@ parse_fcgi_flt(char **args, int *cur_arg, struct proxy *px, if (f->id != fcgi_flt_id) continue; fcgi_conf = f->conf; - if (strcmp(name, fcgi_conf->name)) { + if (strcmp(name, fcgi_conf->name) != 0) { fcgi_conf = NULL; continue; } @@ -606,7 +606,7 @@ static int proxy_parse_use_fcgi_app(char **args, int section, struct proxy *curp list_for_each_entry(fconf, &curpx->filter_configs, list) { if (fconf->id == fcgi_flt_id) { fcgi_conf = fconf->conf; - if (fcgi_conf && !strcmp((char *)fcgi_conf->name, args[1])) + if (fcgi_conf && strcmp((char *)fcgi_conf->name, args[1]) == 0) goto end; memprintf(err, "'%s' : only one fcgi-app supported per backend", args[0]); retval = -1; @@ -773,7 +773,7 @@ static int cfg_parse_fcgi_app(const char *file, int linenum, char **args, int kw const char *err; char *errmsg = NULL; - if (!strcmp(args[0], "fcgi-app")) { /* new fcgi-app */ + if (strcmp(args[0], "fcgi-app") == 0) { /* new fcgi-app */ if (!*(args[1])) { ha_alert("parsing [%s:%d]: '%s' expects as argument.\n", file, linenum, args[0]); @@ -792,7 +792,7 @@ static int cfg_parse_fcgi_app(const char *file, int linenum, char **args, int kw } for (curapp = fcgi_apps; curapp != NULL; curapp = curapp->next) { - if (!strcmp(curapp->name, args[1])) { + if (strcmp(curapp->name, args[1]) == 0) { ha_alert("Parsing [%s:%d]: fcgi-app section '%s' has the same name as another one declared at %s:%d.\n", file, linenum, args[1], curapp->conf.file, curapp->conf.line); err_code |= ERR_ALERT | ERR_FATAL; @@ -845,7 +845,7 @@ static int cfg_parse_fcgi_app(const char *file, int linenum, char **args, int kw err_code |= ERR_ALERT | ERR_FATAL; } } - else if (!strcmp(args[0], "docroot")) { + else if (strcmp(args[0], "docroot") == 0) { if (!*(args[1])) { ha_alert("parsing [%s:%d] : '%s' expects as argument.\n", file, linenum, args[0]); @@ -861,7 +861,7 @@ static int cfg_parse_fcgi_app(const char *file, int linenum, char **args, int kw err_code |= ERR_ALERT | ERR_ABORT; } } - else if (!strcmp(args[0], "path-info")) { + else if (strcmp(args[0], "path-info") == 0) { if (!*(args[1])) { ha_alert("parsing [%s:%d] : '%s' expects as argument.\n", file, linenum, args[0]); @@ -878,7 +878,7 @@ static int cfg_parse_fcgi_app(const char *file, int linenum, char **args, int kw err_code |= ERR_ALERT | ERR_FATAL; } } - else if (!strcmp(args[0], "index")) { + else if (strcmp(args[0], "index") == 0) { if (!*(args[1])) { ha_alert("parsing [%s:%d] : '%s' expects as argument.\n", file, linenum, args[0]); @@ -894,7 +894,7 @@ static int cfg_parse_fcgi_app(const char *file, int linenum, char **args, int kw err_code |= ERR_ALERT | ERR_ABORT; } } - else if (!strcmp(args[0], "acl")) { + else if (strcmp(args[0], "acl") == 0) { const char *err; err = invalid_char(args[1]); if (err) { @@ -917,7 +917,7 @@ static int cfg_parse_fcgi_app(const char *file, int linenum, char **args, int kw goto out; } } - else if (!strcmp(args[0], "set-param")) { + else if (strcmp(args[0], "set-param") == 0) { if (!*(args[1]) || !*(args[2])) { ha_alert("parsing [%s:%d] : '%s' expects and as arguments.\n", file, linenum, args[0]); @@ -968,7 +968,7 @@ static int cfg_parse_fcgi_app(const char *file, int linenum, char **args, int kw goto parse_cond_rule; } #endif - else if (!strcmp(args[0], "pass-header")) { + else if (strcmp(args[0], "pass-header") == 0) { if (!*(args[1])) { ha_alert("parsing [%s:%d] : '%s' expects as arguments.\n", file, linenum, args[0]); @@ -998,13 +998,13 @@ static int cfg_parse_fcgi_app(const char *file, int linenum, char **args, int kw goto parse_cond_rule; } #endif - else if (!strcmp(args[0], "option")) { + else if (strcmp(args[0], "option") == 0) { if (!*(args[1])) { ha_alert("parsing [%s:%d]: '%s' expects an option name.\n", file, linenum, args[0]); err_code |= ERR_ALERT | ERR_FATAL; } - else if (!strcmp(args[1], "keep-conn")) { + else if (strcmp(args[1], "keep-conn") == 0) { if (alertif_too_many_args_idx(0, 1, file, linenum, args, &err_code)) goto out; if (kwm == KWM_STD) @@ -1012,7 +1012,7 @@ static int cfg_parse_fcgi_app(const char *file, int linenum, char **args, int kw else if (kwm == KWM_NO) curapp->flags &= ~FCGI_APP_FL_KEEP_CONN; } - else if (!strcmp(args[1], "get-values")) { + else if (strcmp(args[1], "get-values") == 0) { if (alertif_too_many_args_idx(0, 1, file, linenum, args, &err_code)) goto out; if (kwm == KWM_STD) @@ -1020,7 +1020,7 @@ static int cfg_parse_fcgi_app(const char *file, int linenum, char **args, int kw else if (kwm == KWM_NO) curapp->flags &= ~FCGI_APP_FL_GET_VALUES; } - else if (!strcmp(args[1], "mpxs-conns")) { + else if (strcmp(args[1], "mpxs-conns") == 0) { if (alertif_too_many_args_idx(0, 1, file, linenum, args, &err_code)) goto out; if (kwm == KWM_STD) @@ -1028,7 +1028,7 @@ static int cfg_parse_fcgi_app(const char *file, int linenum, char **args, int kw else if (kwm == KWM_NO) curapp->flags &= ~FCGI_APP_FL_MPXS_CONNS; } - else if (!strcmp(args[1], "max-reqs")) { + else if (strcmp(args[1], "max-reqs") == 0) { if (kwm != KWM_STD) { ha_alert("parsing [%s:%d]: negation/default is not supported for option '%s'.\n", file, linenum, args[1]); @@ -1057,7 +1057,7 @@ static int cfg_parse_fcgi_app(const char *file, int linenum, char **args, int kw err_code |= ERR_ALERT | ERR_FATAL; } } - else if (!strcmp(args[0], "log-stderr")) { + else if (strcmp(args[0], "log-stderr") == 0) { if (!parse_logsrv(args, &curapp->logsrvs, (kwm == KWM_NO), &errmsg)) { ha_alert("parsing [%s:%d] : %s : %s\n", file, linenum, args[0], errmsg); err_code |= ERR_ALERT | ERR_FATAL; diff --git a/src/filters.c b/src/filters.c index 226546649a..fd5c56eab6 100644 --- a/src/filters.c +++ b/src/filters.c @@ -184,7 +184,7 @@ parse_filter(char **args, int section_type, struct proxy *curpx, file, line, args[0]); return -1; } - if (!strcmp(args[0], "filter")) { + if (strcmp(args[0], "filter") == 0) { struct flt_kw *kw; int cur_arg; diff --git a/src/flt_http_comp.c b/src/flt_http_comp.c index 0360d94be2..c8eeba244a 100644 --- a/src/flt_http_comp.c +++ b/src/flt_http_comp.c @@ -629,7 +629,7 @@ parse_compression_options(char **args, int section, struct proxy *proxy, else comp = proxy->comp; - if (!strcmp(args[1], "algo")) { + if (strcmp(args[1], "algo") == 0) { struct comp_ctx *ctx; int cur_arg = 2; @@ -655,9 +655,9 @@ parse_compression_options(char **args, int section, struct proxy *proxy, continue; } } - else if (!strcmp(args[1], "offload")) + else if (strcmp(args[1], "offload") == 0) comp->offload = 1; - else if (!strcmp(args[1], "type")) { + else if (strcmp(args[1], "type") == 0) { int cur_arg = 2; if (!*args[cur_arg]) { diff --git a/src/flt_spoe.c b/src/flt_spoe.c index 2de26b4a59..45370fee66 100644 --- a/src/flt_spoe.c +++ b/src/flt_spoe.c @@ -3036,7 +3036,7 @@ spoe_check(struct proxy *px, struct flt_conf *fconf) continue; /* Check engine Id. It should be uniq */ - if (!strcmp(conf->id, c->id)) { + if (strcmp(conf->id, c->id) == 0) { ha_alert("Proxy %s : duplicated name for SPOE engine '%s'.\n", px->id, conf->id); return 1; @@ -3322,10 +3322,10 @@ cfg_parse_spoe_agent(const char *file, int linenum, char **args, int kwm) if ((cfg_scope == NULL && curengine != NULL) || (cfg_scope != NULL && curengine == NULL) || - (curengine != NULL && cfg_scope != NULL && strcmp(curengine, cfg_scope))) + (curengine != NULL && cfg_scope != NULL && strcmp(curengine, cfg_scope) != 0)) goto out; - if (!strcmp(args[0], "spoe-agent")) { /* new spoe-agent section */ + if (strcmp(args[0], "spoe-agent") == 0) { /* new spoe-agent section */ if (!*args[1]) { ha_alert("parsing [%s:%d] : missing name for spoe-agent section.\n", file, linenum); @@ -3381,7 +3381,7 @@ cfg_parse_spoe_agent(const char *file, int linenum, char **args, int kwm) LIST_INIT(&curagent->groups); LIST_INIT(&curagent->messages); } - else if (!strcmp(args[0], "use-backend")) { + else if (strcmp(args[0], "use-backend") == 0) { if (!*args[1]) { ha_alert("parsing [%s:%d] : '%s' expects a backend name.\n", file, linenum, args[0]); @@ -3393,13 +3393,13 @@ cfg_parse_spoe_agent(const char *file, int linenum, char **args, int kwm) free(curagent->b.name); curagent->b.name = strdup(args[1]); } - else if (!strcmp(args[0], "messages")) { + else if (strcmp(args[0], "messages") == 0) { int cur_arg = 1; while (*args[cur_arg]) { struct spoe_placeholder *ph = NULL; list_for_each_entry(ph, &curmphs, list) { - if (!strcmp(ph->id, args[cur_arg])) { + if (strcmp(ph->id, args[cur_arg]) == 0) { ha_alert("parsing [%s:%d]: spoe-message '%s' already used.\n", file, linenum, args[cur_arg]); err_code |= ERR_ALERT | ERR_FATAL; @@ -3417,13 +3417,13 @@ cfg_parse_spoe_agent(const char *file, int linenum, char **args, int kwm) cur_arg++; } } - else if (!strcmp(args[0], "groups")) { + else if (strcmp(args[0], "groups") == 0) { int cur_arg = 1; while (*args[cur_arg]) { struct spoe_placeholder *ph = NULL; list_for_each_entry(ph, &curgphs, list) { - if (!strcmp(ph->id, args[cur_arg])) { + if (strcmp(ph->id, args[cur_arg]) == 0) { ha_alert("parsing [%s:%d]: spoe-group '%s' already used.\n", file, linenum, args[cur_arg]); err_code |= ERR_ALERT | ERR_FATAL; @@ -3441,7 +3441,7 @@ cfg_parse_spoe_agent(const char *file, int linenum, char **args, int kwm) cur_arg++; } } - else if (!strcmp(args[0], "timeout")) { + else if (strcmp(args[0], "timeout") == 0) { unsigned int *tv = NULL; const char *res; unsigned timeout; @@ -3454,11 +3454,11 @@ cfg_parse_spoe_agent(const char *file, int linenum, char **args, int kwm) } if (alertif_too_many_args(2, file, linenum, args, &err_code)) goto out; - if (!strcmp(args[1], "hello")) + if (strcmp(args[1], "hello") == 0) tv = &curagent->timeout.hello; - else if (!strcmp(args[1], "idle")) + else if (strcmp(args[1], "idle") == 0) tv = &curagent->timeout.idle; - else if (!strcmp(args[1], "processing")) + else if (strcmp(args[1], "processing") == 0) tv = &curagent->timeout.processing; else { ha_alert("parsing [%s:%d] : 'timeout' supports 'hello', 'idle' or 'processing' (got %s).\n", @@ -3493,7 +3493,7 @@ cfg_parse_spoe_agent(const char *file, int linenum, char **args, int kwm) } *tv = MS_TO_TICKS(timeout); } - else if (!strcmp(args[0], "option")) { + else if (strcmp(args[0], "option") == 0) { if (!*args[1]) { ha_alert("parsing [%s:%d]: '%s' expects an option name.\n", file, linenum, args[0]); @@ -3501,7 +3501,7 @@ cfg_parse_spoe_agent(const char *file, int linenum, char **args, int kwm) goto out; } - if (!strcmp(args[1], "pipelining")) { + if (strcmp(args[1], "pipelining") == 0) { if (alertif_too_many_args(1, file, linenum, args, &err_code)) goto out; if (kwm == 1) @@ -3510,7 +3510,7 @@ cfg_parse_spoe_agent(const char *file, int linenum, char **args, int kwm) curagent->flags |= SPOE_FL_PIPELINING; goto out; } - else if (!strcmp(args[1], "async")) { + else if (strcmp(args[1], "async") == 0) { if (alertif_too_many_args(1, file, linenum, args, &err_code)) goto out; if (kwm == 1) @@ -3519,7 +3519,7 @@ cfg_parse_spoe_agent(const char *file, int linenum, char **args, int kwm) curagent->flags |= SPOE_FL_ASYNC; goto out; } - else if (!strcmp(args[1], "send-frag-payload")) { + else if (strcmp(args[1], "send-frag-payload") == 0) { if (alertif_too_many_args(1, file, linenum, args, &err_code)) goto out; if (kwm == 1) @@ -3528,7 +3528,7 @@ cfg_parse_spoe_agent(const char *file, int linenum, char **args, int kwm) curagent->flags |= SPOE_FL_SND_FRAGMENTATION; goto out; } - else if (!strcmp(args[1], "dontlog-normal")) { + else if (strcmp(args[1], "dontlog-normal") == 0) { if (alertif_too_many_args(1, file, linenum, args, &err_code)) goto out; if (kwm == 1) @@ -3546,7 +3546,7 @@ cfg_parse_spoe_agent(const char *file, int linenum, char **args, int kwm) goto out; } - if (!strcmp(args[1], "var-prefix")) { + if (strcmp(args[1], "var-prefix") == 0) { char *tmp; if (!*args[2]) { @@ -3570,17 +3570,17 @@ cfg_parse_spoe_agent(const char *file, int linenum, char **args, int kwm) } curagent->var_pfx = strdup(args[2]); } - else if (!strcmp(args[1], "force-set-var")) { + else if (strcmp(args[1], "force-set-var") == 0) { if (alertif_too_many_args(1, file, linenum, args, &err_code)) goto out; curagent->flags |= SPOE_FL_FORCE_SET_VAR; } - else if (!strcmp(args[1], "continue-on-error")) { + else if (strcmp(args[1], "continue-on-error") == 0) { if (alertif_too_many_args(1, file, linenum, args, &err_code)) goto out; curagent->flags |= SPOE_FL_CONT_ON_ERR; } - else if (!strcmp(args[1], "set-on-error")) { + else if (strcmp(args[1], "set-on-error") == 0) { char *tmp; if (!*args[2]) { @@ -3604,7 +3604,7 @@ cfg_parse_spoe_agent(const char *file, int linenum, char **args, int kwm) } curagent->var_on_error = strdup(args[2]); } - else if (!strcmp(args[1], "set-process-time")) { + else if (strcmp(args[1], "set-process-time") == 0) { char *tmp; if (!*args[2]) { @@ -3628,7 +3628,7 @@ cfg_parse_spoe_agent(const char *file, int linenum, char **args, int kwm) } curagent->var_t_process = strdup(args[2]); } - else if (!strcmp(args[1], "set-total-time")) { + else if (strcmp(args[1], "set-total-time") == 0) { char *tmp; if (!*args[2]) { @@ -3659,7 +3659,7 @@ cfg_parse_spoe_agent(const char *file, int linenum, char **args, int kwm) goto out; } } - else if (!strcmp(args[0], "maxconnrate")) { + else if (strcmp(args[0], "maxconnrate") == 0) { if (!*args[1]) { ha_alert("parsing [%s:%d] : '%s' expects an integer argument.\n", file, linenum, args[0]); @@ -3670,7 +3670,7 @@ cfg_parse_spoe_agent(const char *file, int linenum, char **args, int kwm) goto out; curagent->cps_max = atol(args[1]); } - else if (!strcmp(args[0], "maxerrrate")) { + else if (strcmp(args[0], "maxerrrate") == 0) { if (!*args[1]) { ha_alert("parsing [%s:%d] : '%s' expects an integer argument.\n", file, linenum, args[0]); @@ -3681,7 +3681,7 @@ cfg_parse_spoe_agent(const char *file, int linenum, char **args, int kwm) goto out; curagent->eps_max = atol(args[1]); } - else if (!strcmp(args[0], "max-frame-size")) { + else if (strcmp(args[0], "max-frame-size") == 0) { if (!*args[1]) { ha_alert("parsing [%s:%d] : '%s' expects an integer argument.\n", file, linenum, args[0]); @@ -3699,7 +3699,7 @@ cfg_parse_spoe_agent(const char *file, int linenum, char **args, int kwm) goto out; } } - else if (!strcmp(args[0], "max-waiting-frames")) { + else if (strcmp(args[0], "max-waiting-frames") == 0) { if (!*args[1]) { ha_alert("parsing [%s:%d] : '%s' expects an integer argument.\n", file, linenum, args[0]); @@ -3716,7 +3716,7 @@ cfg_parse_spoe_agent(const char *file, int linenum, char **args, int kwm) goto out; } } - else if (!strcmp(args[0], "register-var-names")) { + else if (strcmp(args[0], "register-var-names") == 0) { int cur_arg; if (!*args[1]) { @@ -3744,7 +3744,7 @@ cfg_parse_spoe_agent(const char *file, int linenum, char **args, int kwm) cur_arg++; } } - else if (!strcmp(args[0], "log")) { + else if (strcmp(args[0], "log") == 0) { char *errmsg = NULL; if (!parse_logsrv(args, &curlogsrvs, (kwm == 1), &errmsg)) { @@ -3771,10 +3771,10 @@ cfg_parse_spoe_group(const char *file, int linenum, char **args, int kwm) if ((cfg_scope == NULL && curengine != NULL) || (cfg_scope != NULL && curengine == NULL) || - (curengine != NULL && cfg_scope != NULL && strcmp(curengine, cfg_scope))) + (curengine != NULL && cfg_scope != NULL && strcmp(curengine, cfg_scope) != 0)) goto out; - if (!strcmp(args[0], "spoe-group")) { /* new spoe-group section */ + if (strcmp(args[0], "spoe-group") == 0) { /* new spoe-group section */ if (!*args[1]) { ha_alert("parsing [%s:%d] : missing name for spoe-group section.\n", file, linenum); @@ -3795,7 +3795,7 @@ cfg_parse_spoe_group(const char *file, int linenum, char **args, int kwm) } list_for_each_entry(grp, &curgrps, list) { - if (!strcmp(grp->id, args[1])) { + if (strcmp(grp->id, args[1]) == 0) { ha_alert("parsing [%s:%d]: spoe-group section '%s' has the same" " name as another one declared at %s:%d.\n", file, linenum, args[1], grp->conf.file, grp->conf.line); @@ -3817,13 +3817,13 @@ cfg_parse_spoe_group(const char *file, int linenum, char **args, int kwm) LIST_INIT(&curgrp->messages); LIST_ADDQ(&curgrps, &curgrp->list); } - else if (!strcmp(args[0], "messages")) { + else if (strcmp(args[0], "messages") == 0) { int cur_arg = 1; while (*args[cur_arg]) { struct spoe_placeholder *ph = NULL; list_for_each_entry(ph, &curgrp->phs, list) { - if (!strcmp(ph->id, args[cur_arg])) { + if (strcmp(ph->id, args[cur_arg]) == 0) { ha_alert("parsing [%s:%d]: spoe-message '%s' already used.\n", file, linenum, args[cur_arg]); err_code |= ERR_ALERT | ERR_FATAL; @@ -3862,10 +3862,10 @@ cfg_parse_spoe_message(const char *file, int linenum, char **args, int kwm) if ((cfg_scope == NULL && curengine != NULL) || (cfg_scope != NULL && curengine == NULL) || - (curengine != NULL && cfg_scope != NULL && strcmp(curengine, cfg_scope))) + (curengine != NULL && cfg_scope != NULL && strcmp(curengine, cfg_scope) != 0)) goto out; - if (!strcmp(args[0], "spoe-message")) { /* new spoe-message section */ + if (strcmp(args[0], "spoe-message") == 0) { /* new spoe-message section */ if (!*args[1]) { ha_alert("parsing [%s:%d] : missing name for spoe-message section.\n", file, linenum); @@ -3886,7 +3886,7 @@ cfg_parse_spoe_message(const char *file, int linenum, char **args, int kwm) } list_for_each_entry(msg, &curmsgs, list) { - if (!strcmp(msg->id, args[1])) { + if (strcmp(msg->id, args[1]) == 0) { ha_alert("parsing [%s:%d]: spoe-message section '%s' has the same" " name as another one declared at %s:%d.\n", file, linenum, args[1], msg->conf.file, msg->conf.line); @@ -3913,7 +3913,7 @@ cfg_parse_spoe_message(const char *file, int linenum, char **args, int kwm) LIST_INIT(&curmsg->by_grp); LIST_ADDQ(&curmsgs, &curmsg->list); } - else if (!strcmp(args[0], "args")) { + else if (strcmp(args[0], "args") == 0) { int cur_arg = 1; curproxy->conf.args.ctx = ARGC_SPOE; @@ -3956,7 +3956,7 @@ cfg_parse_spoe_message(const char *file, int linenum, char **args, int kwm) curproxy->conf.args.file = NULL; curproxy->conf.args.line = 0; } - else if (!strcmp(args[0], "acl")) { + else if (strcmp(args[0], "acl") == 0) { err = invalid_char(args[1]); if (err) { ha_alert("parsing [%s:%d] : character '%c' is not permitted in acl name '%s'.\n", @@ -3978,7 +3978,7 @@ cfg_parse_spoe_message(const char *file, int linenum, char **args, int kwm) goto out; } } - else if (!strcmp(args[0], "event")) { + else if (strcmp(args[0], "event") == 0) { if (!*args[1]) { ha_alert("parsing [%s:%d] : missing event name.\n", file, linenum); err_code |= ERR_ALERT | ERR_FATAL; @@ -3987,23 +3987,23 @@ cfg_parse_spoe_message(const char *file, int linenum, char **args, int kwm) /* if (alertif_too_many_args(1, file, linenum, args, &err_code)) */ /* goto out; */ - if (!strcmp(args[1], spoe_event_str[SPOE_EV_ON_CLIENT_SESS])) + if (strcmp(args[1], spoe_event_str[SPOE_EV_ON_CLIENT_SESS]) == 0) curmsg->event = SPOE_EV_ON_CLIENT_SESS; - else if (!strcmp(args[1], spoe_event_str[SPOE_EV_ON_SERVER_SESS])) + else if (strcmp(args[1], spoe_event_str[SPOE_EV_ON_SERVER_SESS]) == 0) curmsg->event = SPOE_EV_ON_SERVER_SESS; - else if (!strcmp(args[1], spoe_event_str[SPOE_EV_ON_TCP_REQ_FE])) + else if (strcmp(args[1], spoe_event_str[SPOE_EV_ON_TCP_REQ_FE]) == 0) curmsg->event = SPOE_EV_ON_TCP_REQ_FE; - else if (!strcmp(args[1], spoe_event_str[SPOE_EV_ON_TCP_REQ_BE])) + else if (strcmp(args[1], spoe_event_str[SPOE_EV_ON_TCP_REQ_BE]) == 0) curmsg->event = SPOE_EV_ON_TCP_REQ_BE; - else if (!strcmp(args[1], spoe_event_str[SPOE_EV_ON_TCP_RSP])) + else if (strcmp(args[1], spoe_event_str[SPOE_EV_ON_TCP_RSP]) == 0) curmsg->event = SPOE_EV_ON_TCP_RSP; - else if (!strcmp(args[1], spoe_event_str[SPOE_EV_ON_HTTP_REQ_FE])) + else if (strcmp(args[1], spoe_event_str[SPOE_EV_ON_HTTP_REQ_FE]) == 0) curmsg->event = SPOE_EV_ON_HTTP_REQ_FE; - else if (!strcmp(args[1], spoe_event_str[SPOE_EV_ON_HTTP_REQ_BE])) + else if (strcmp(args[1], spoe_event_str[SPOE_EV_ON_HTTP_REQ_BE]) == 0) curmsg->event = SPOE_EV_ON_HTTP_REQ_BE; - else if (!strcmp(args[1], spoe_event_str[SPOE_EV_ON_HTTP_RSP])) + else if (strcmp(args[1], spoe_event_str[SPOE_EV_ON_HTTP_RSP]) == 0) curmsg->event = SPOE_EV_ON_HTTP_RSP; else { ha_alert("parsing [%s:%d] : unknown event '%s'.\n", @@ -4078,7 +4078,7 @@ parse_spoe_flt(char **args, int *cur_arg, struct proxy *px, conf->proxy = px; while (*args[pos]) { - if (!strcmp(args[pos], "config")) { + if (strcmp(args[pos], "config") == 0) { if (!*args[pos+1]) { memprintf(err, "'%s' : '%s' option without value", args[*cur_arg], args[pos]); @@ -4087,7 +4087,7 @@ parse_spoe_flt(char **args, int *cur_arg, struct proxy *px, file = args[pos+1]; pos += 2; } - else if (!strcmp(args[pos], "engine")) { + else if (strcmp(args[pos], "engine") == 0) { if (!*args[pos+1]) { memprintf(err, "'%s' : '%s' option without value", args[*cur_arg], args[pos]); @@ -4233,7 +4233,7 @@ parse_spoe_flt(char **args, int *cur_arg, struct proxy *px, struct spoe_arg *arg; unsigned int where; - if (!strcmp(msg->id, ph->id)) { + if (strcmp(msg->id, ph->id) == 0) { if ((px->cap & (PR_CAP_FE|PR_CAP_BE)) == (PR_CAP_FE|PR_CAP_BE)) { if (msg->event == SPOE_EV_ON_TCP_REQ_BE) msg->event = SPOE_EV_ON_TCP_REQ_FE; @@ -4331,7 +4331,7 @@ parse_spoe_flt(char **args, int *cur_arg, struct proxy *px, * agent */ list_for_each_entry(ph, &curgphs, list) { list_for_each_entry_safe(grp, grpback, &curgrps, list) { - if (!strcmp(grp->id, ph->id)) { + if (strcmp(grp->id, ph->id) == 0) { grp->agent = curagent; LIST_DEL(&grp->list); LIST_ADDQ(&curagent->groups, &grp->list); @@ -4350,7 +4350,7 @@ parse_spoe_flt(char **args, int *cur_arg, struct proxy *px, list_for_each_entry(grp, &curagent->groups, list) { list_for_each_entry_safe(ph, phback, &grp->phs, list) { list_for_each_entry(msg, &curmsgs, list) { - if (!strcmp(msg->id, ph->id)) { + if (strcmp(msg->id, ph->id) == 0) { if (msg->group != NULL) { memprintf(err, "SPOE message '%s' already belongs to " "the SPOE group '%s' declare at %s:%d", @@ -4583,7 +4583,7 @@ check_send_spoe_group(struct act_rule *rule, struct proxy *px, char **err) continue; /* This is the good engine */ - if (!strcmp(conf->id, engine_id)) { + if (strcmp(conf->id, engine_id) == 0) { agent = conf->agent; break; } @@ -4597,7 +4597,7 @@ check_send_spoe_group(struct act_rule *rule, struct proxy *px, char **err) /* Try to find the right group */ list_for_each_entry(group, &agent->groups, list) { /* This is the good group */ - if (!strcmp(group->id, group_id)) + if (strcmp(group->id, group_id) == 0) break; } if (&group->list == &agent->groups) { diff --git a/src/flt_trace.c b/src/flt_trace.c index a79cddc6ab..206beda599 100644 --- a/src/flt_trace.c +++ b/src/flt_trace.c @@ -623,11 +623,11 @@ parse_trace_flt(char **args, int *cur_arg, struct proxy *px, } conf->proxy = px; conf->flags = 0; - if (!strcmp(args[pos], "trace")) { + if (strcmp(args[pos], "trace") == 0) { pos++; while (*args[pos]) { - if (!strcmp(args[pos], "name")) { + if (strcmp(args[pos], "name") == 0) { if (!*args[pos + 1]) { memprintf(err, "'%s' : '%s' option without value", args[*cur_arg], args[pos]); @@ -640,13 +640,13 @@ parse_trace_flt(char **args, int *cur_arg, struct proxy *px, } pos++; } - else if (!strcmp(args[pos], "quiet")) + else if (strcmp(args[pos], "quiet") == 0) conf->flags |= TRACE_F_QUIET; - else if (!strcmp(args[pos], "random-parsing")) + else if (strcmp(args[pos], "random-parsing") == 0) continue; // ignore - else if (!strcmp(args[pos], "random-forwarding")) + else if (strcmp(args[pos], "random-forwarding") == 0) conf->flags |= TRACE_F_RAND_FWD; - else if (!strcmp(args[pos], "hexdump")) + else if (strcmp(args[pos], "hexdump") == 0) conf->flags |= TRACE_F_HEXDUMP; else break; diff --git a/src/haproxy.c b/src/haproxy.c index f6236fb92e..7044f4aeb5 100644 --- a/src/haproxy.c +++ b/src/haproxy.c @@ -731,7 +731,7 @@ static void get_cur_unixsocket() if (!cur_unixsocket) { cur_unixsocket = strdup(un->sun_path); } else { - if (old_unixsocket && !strcmp(un->sun_path, old_unixsocket)) { + if (old_unixsocket && strcmp(un->sun_path, old_unixsocket) == 0) { free(cur_unixsocket); cur_unixsocket = strdup(old_unixsocket); return; diff --git a/src/hlua.c b/src/hlua.c index 6fff601473..ca07bb8a38 100644 --- a/src/hlua.c +++ b/src/hlua.c @@ -913,7 +913,7 @@ __LJMP int hlua_lua2arg_check(lua_State *L, int first, struct arg *argp, goto error; } if (p->uri_auth && p->uri_auth->userlist && - !strcmp(p->uri_auth->userlist->name, argp[idx].data.str.area)) + strcmp(p->uri_auth->userlist->name, argp[idx].data.str.area) == 0) ul = p->uri_auth->userlist; else ul = auth_find_userlist(argp[idx].data.str.area); diff --git a/src/http_act.c b/src/http_act.c index 140cdf1a9f..9a49368782 100644 --- a/src/http_act.c +++ b/src/http_act.c @@ -853,7 +853,7 @@ static enum act_parse_ret parse_http_deny(const char **args, int *orig_arg, stru cur_arg = *orig_arg; if (rule->from == ACT_F_HTTP_REQ) { - if (!strcmp(args[cur_arg-1], "tarpit")) { + if (strcmp(args[cur_arg - 1], "tarpit") == 0) { rule->action = ACT_HTTP_REQ_TARPIT; default_status = 500; } @@ -995,7 +995,7 @@ static enum act_parse_ret parse_http_auth(const char **args, int *orig_arg, stru rule->release_ptr = release_http_action; cur_arg = *orig_arg; - if (!strcmp(args[cur_arg], "realm")) { + if (strcmp(args[cur_arg], "realm") == 0) { cur_arg++; if (!*args[cur_arg]) { memprintf(err, "missing realm value.\n"); diff --git a/src/http_htx.c b/src/http_htx.c index 9570b1ea7a..640a3dc8b4 100644 --- a/src/http_htx.c +++ b/src/http_htx.c @@ -1751,7 +1751,7 @@ static int proxy_parse_errorloc(char **args, int section, struct proxy *curpx, } status = atol(args[1]); - errloc = (!strcmp(args[0], "errorloc303") ? 303 : 302); + errloc = (strcmp(args[0], "errorloc303") == 0 ? 303 : 302); msg = http_parse_errorloc(errloc, status, args[2], errmsg); if (!msg) { memprintf(errmsg, "%s : %s", args[0], *errmsg); @@ -2184,7 +2184,7 @@ static int cfg_parse_http_errors(const char *file, int linenum, char **args, int curr_errs->conf.file = strdup(file); curr_errs->conf.line = linenum; } - else if (!strcmp(args[0], "errorfile")) { /* error message from a file */ + else if (strcmp(args[0], "errorfile") == 0) { /* error message from a file */ struct http_reply *reply; struct buffer *msg; int status, rc; diff --git a/src/http_rules.c b/src/http_rules.c index 2ac1fefc14..f77d785eae 100644 --- a/src/http_rules.c +++ b/src/http_rules.c @@ -337,10 +337,10 @@ struct redirect_rule *http_parse_redirect_rule(const char *file, int linenum, st return NULL; } } - else if (!strcmp(args[cur_arg],"drop-query")) { + else if (strcmp(args[cur_arg], "drop-query") == 0) { flags |= REDIRECT_FLAG_DROP_QS; } - else if (!strcmp(args[cur_arg],"append-slash")) { + else if (strcmp(args[cur_arg], "append-slash") == 0) { flags |= REDIRECT_FLAG_APPEND_SLASH; } else if (strcmp(args[cur_arg], "if") == 0 || diff --git a/src/log.c b/src/log.c index 632e8bd801..a1de7e57a2 100644 --- a/src/log.c +++ b/src/log.c @@ -835,7 +835,7 @@ int parse_logsrv(char **args, struct list *logsrvs, int do_del, char **err) * "log global": copy global.logrsvs linked list to the end of logsrvs * list. But first, we check (logsrvs != global.logsrvs). */ - if (*(args[1]) && *(args[2]) == 0 && !strcmp(args[1], "global")) { + if (*(args[1]) && *(args[2]) == 0 && strcmp(args[1], "global") == 0) { if (logsrvs == &global.logsrvs) { memprintf(err, "'global' is not supported for a global syslog server"); goto error; @@ -1166,7 +1166,7 @@ enum log_fmt get_log_format(const char *fmt) format = LOG_FORMATS - 1; while (format > 0 && log_formats[format].name - && strcmp(log_formats[format].name, fmt)) + && strcmp(log_formats[format].name, fmt) != 0) format--; /* Note: 0 is LOG_FORMAT_UNSPEC */ @@ -1181,7 +1181,7 @@ int get_log_level(const char *lev) int level; level = NB_LOG_LEVELS - 1; - while (level >= 0 && strcmp(log_levels[level], lev)) + while (level >= 0 && strcmp(log_levels[level], lev) != 0) level--; return level; @@ -1195,7 +1195,7 @@ int get_log_facility(const char *fac) int facility; facility = NB_LOG_FACILITIES - 1; - while (facility >= 0 && strcmp(log_facilities[facility], fac)) + while (facility >= 0 && strcmp(log_facilities[facility], fac) != 0) facility--; return facility; @@ -3863,7 +3863,7 @@ int cfg_parse_log_forward(const char *file, int linenum, char **args, int kwm) px->id = strdup(args[1]); } - else if (!strcmp(args[0], "maxconn")) { /* maxconn */ + else if (strcmp(args[0], "maxconn") == 0) { /* maxconn */ if (warnifnotcap(cfg_log_forward, PR_CAP_FE, file, linenum, args[0], " Maybe you want 'fullconn' instead ?")) err_code |= ERR_WARN; @@ -3876,7 +3876,7 @@ int cfg_parse_log_forward(const char *file, int linenum, char **args, int kwm) if (alertif_too_many_args(1, file, linenum, args, &err_code)) goto out; } - else if (!strcmp(args[0], "backlog")) { /* backlog */ + else if (strcmp(args[0], "backlog") == 0) { /* backlog */ if (warnifnotcap(cfg_log_forward, PR_CAP_FE, file, linenum, args[0], NULL)) err_code |= ERR_WARN; diff --git a/src/mux_h1.c b/src/mux_h1.c index 81b0e0e30c..3ed0001a76 100644 --- a/src/mux_h1.c +++ b/src/mux_h1.c @@ -3183,7 +3183,7 @@ static int add_hdr_case_adjust(const char *from, const char *to, char **err) } /* Be sure only the case differs between and */ - if (strcasecmp(from, to)) { + if (strcasecmp(from, to) != 0) { memprintf(err, " and must not differ execpt the case"); return -1; } diff --git a/src/mworker-prog.c b/src/mworker-prog.c index e77317f448..8d404cb519 100644 --- a/src/mworker-prog.c +++ b/src/mworker-prog.c @@ -65,7 +65,7 @@ int mworker_ext_launch_all() if (!(old_child->options & PROC_O_TYPE_PROG) || (!(old_child->options & PROC_O_LEAVING))) continue; - if (!strcmp(old_child->id, child->id)) + if (strcmp(old_child->id, child->id) == 0) old_child->options &= ~PROC_O_LEAVING; } @@ -131,7 +131,7 @@ int cfg_parse_program(const char *file, int linenum, char **args, int kwm) struct mworker_proc *child; int err_code = 0; - if (!strcmp(args[0], "program")) { + if (strcmp(args[0], "program") == 0) { if (alertif_too_many_args(1, file, linenum, args, &err_code)) { err_code |= ERR_ABORT; goto error; @@ -168,7 +168,7 @@ int cfg_parse_program(const char *file, int linenum, char **args, int kwm) list_for_each_entry(child, &proc_list, list) { if (child->reloads == 0 && (child->options & PROC_O_TYPE_PROG)) { - if (!strcmp(args[1], child->id)) { + if (strcmp(args[1], child->id) == 0) { ha_alert("parsing [%s:%d]: '%s' program section already exists in the configuration.\n", file, linenum, args[1]); err_code |= ERR_ALERT | ERR_ABORT; goto error; @@ -185,7 +185,7 @@ int cfg_parse_program(const char *file, int linenum, char **args, int kwm) LIST_ADDQ(&proc_list, &ext_child->list); - } else if (!strcmp(args[0], "command")) { + } else if (strcmp(args[0], "command") == 0) { int arg_nb = 0; int i = 0; @@ -217,7 +217,7 @@ int cfg_parse_program(const char *file, int linenum, char **args, int kwm) } ext_child->command[i] = NULL; - } else if (!strcmp(args[0], "option")) { + } else if (strcmp(args[0], "option") == 0) { if (*(args[1]) == '\0') { ha_alert("parsing [%s:%d]: '%s' expects an option name.\n", @@ -240,7 +240,7 @@ int cfg_parse_program(const char *file, int linenum, char **args, int kwm) err_code |= ERR_ALERT | ERR_FATAL; goto error; } - } else if (!strcmp(args[0], "user")) { + } else if (strcmp(args[0], "user") == 0) { struct passwd *ext_child_user; if (*(args[1]) == '\0') { ha_alert("parsing [%s:%d]: '%s' expects a user name.\n", @@ -265,7 +265,7 @@ int cfg_parse_program(const char *file, int linenum, char **args, int kwm) ha_alert("parsing [%s:%d] : cannot find user id for '%s' (%d:%s)\n", file, linenum, args[1], errno, strerror(errno)); err_code |= ERR_ALERT | ERR_FATAL; } - } else if (!strcmp(args[0], "group")) { + } else if (strcmp(args[0], "group") == 0) { struct group *ext_child_group; if (*(args[1]) == '\0') { ha_alert("parsing [%s:%d]: '%s' expects a group name.\n", diff --git a/src/peers.c b/src/peers.c index 3fa1a28b4f..3a97d8a90f 100644 --- a/src/peers.c +++ b/src/peers.c @@ -3168,7 +3168,7 @@ static int cli_parse_show_peers(char **args, char *payload, struct appctx *appct struct peers *p; for (p = cfg_peers; p; p = p->next) { - if (!strcmp(p->id, args[2])) { + if (strcmp(p->id, args[2]) == 0) { appctx->ctx.cfgpeers.target = p; break; } diff --git a/src/proxy.c b/src/proxy.c index fb5c98c9ef..a47c2f67e3 100644 --- a/src/proxy.c +++ b/src/proxy.c @@ -206,60 +206,60 @@ static int proxy_parse_timeout(char **args, int section, struct proxy *proxy, args++; name = args[0]; - if (!strcmp(args[0], "client")) { + if (strcmp(args[0], "client") == 0) { name = "client"; tv = &proxy->timeout.client; td = &defpx->timeout.client; cap = PR_CAP_FE; - } else if (!strcmp(args[0], "tarpit")) { + } else if (strcmp(args[0], "tarpit") == 0) { tv = &proxy->timeout.tarpit; td = &defpx->timeout.tarpit; cap = PR_CAP_FE | PR_CAP_BE; - } else if (!strcmp(args[0], "http-keep-alive")) { + } else if (strcmp(args[0], "http-keep-alive") == 0) { tv = &proxy->timeout.httpka; td = &defpx->timeout.httpka; cap = PR_CAP_FE | PR_CAP_BE; - } else if (!strcmp(args[0], "http-request")) { + } else if (strcmp(args[0], "http-request") == 0) { tv = &proxy->timeout.httpreq; td = &defpx->timeout.httpreq; cap = PR_CAP_FE | PR_CAP_BE; - } else if (!strcmp(args[0], "server")) { + } else if (strcmp(args[0], "server") == 0) { name = "server"; tv = &proxy->timeout.server; td = &defpx->timeout.server; cap = PR_CAP_BE; - } else if (!strcmp(args[0], "connect")) { + } else if (strcmp(args[0], "connect") == 0) { name = "connect"; tv = &proxy->timeout.connect; td = &defpx->timeout.connect; cap = PR_CAP_BE; - } else if (!strcmp(args[0], "check")) { + } else if (strcmp(args[0], "check") == 0) { tv = &proxy->timeout.check; td = &defpx->timeout.check; cap = PR_CAP_BE; - } else if (!strcmp(args[0], "queue")) { + } else if (strcmp(args[0], "queue") == 0) { tv = &proxy->timeout.queue; td = &defpx->timeout.queue; cap = PR_CAP_BE; - } else if (!strcmp(args[0], "tunnel")) { + } else if (strcmp(args[0], "tunnel") == 0) { tv = &proxy->timeout.tunnel; td = &defpx->timeout.tunnel; cap = PR_CAP_BE; - } else if (!strcmp(args[0], "client-fin")) { + } else if (strcmp(args[0], "client-fin") == 0) { tv = &proxy->timeout.clientfin; td = &defpx->timeout.clientfin; cap = PR_CAP_FE; - } else if (!strcmp(args[0], "server-fin")) { + } else if (strcmp(args[0], "server-fin") == 0) { tv = &proxy->timeout.serverfin; td = &defpx->timeout.serverfin; cap = PR_CAP_BE; - } else if (!strcmp(args[0], "clitimeout")) { + } else if (strcmp(args[0], "clitimeout") == 0) { memprintf(err, "the '%s' directive is not supported anymore since HAProxy 2.1. Use 'timeout client'.", args[0]); return -1; - } else if (!strcmp(args[0], "srvtimeout")) { + } else if (strcmp(args[0], "srvtimeout") == 0) { memprintf(err, "the '%s' directive is not supported anymore since HAProxy 2.1. Use 'timeout server'.", args[0]); return -1; - } else if (!strcmp(args[0], "contimeout")) { + } else if (strcmp(args[0], "contimeout") == 0) { memprintf(err, "the '%s' directive is not supported anymore since HAProxy 2.1. Use 'timeout connect'.", args[0]); return -1; } else { @@ -522,42 +522,42 @@ proxy_parse_retry_on(char **args, int section, struct proxy *curpx, } curpx->retry_type = 0; for (i = 1; *(args[i]); i++) { - if (!strcmp(args[i], "conn-failure")) + if (strcmp(args[i], "conn-failure") == 0) curpx->retry_type |= PR_RE_CONN_FAILED; - else if (!strcmp(args[i], "empty-response")) + else if (strcmp(args[i], "empty-response") == 0) curpx->retry_type |= PR_RE_DISCONNECTED; - else if (!strcmp(args[i], "response-timeout")) + else if (strcmp(args[i], "response-timeout") == 0) curpx->retry_type |= PR_RE_TIMEOUT; - else if (!strcmp(args[i], "401")) + else if (strcmp(args[i], "401") == 0) curpx->retry_type |= PR_RE_401; - else if (!strcmp(args[i], "403")) + else if (strcmp(args[i], "403") == 0) curpx->retry_type |= PR_RE_403; - else if (!strcmp(args[i], "404")) + else if (strcmp(args[i], "404") == 0) curpx->retry_type |= PR_RE_404; - else if (!strcmp(args[i], "408")) + else if (strcmp(args[i], "408") == 0) curpx->retry_type |= PR_RE_408; - else if (!strcmp(args[i], "425")) + else if (strcmp(args[i], "425") == 0) curpx->retry_type |= PR_RE_425; - else if (!strcmp(args[i], "500")) + else if (strcmp(args[i], "500") == 0) curpx->retry_type |= PR_RE_500; - else if (!strcmp(args[i], "501")) + else if (strcmp(args[i], "501") == 0) curpx->retry_type |= PR_RE_501; - else if (!strcmp(args[i], "502")) + else if (strcmp(args[i], "502") == 0) curpx->retry_type |= PR_RE_502; - else if (!strcmp(args[i], "503")) + else if (strcmp(args[i], "503") == 0) curpx->retry_type |= PR_RE_503; - else if (!strcmp(args[i], "504")) + else if (strcmp(args[i], "504") == 0) curpx->retry_type |= PR_RE_504; - else if (!strcmp(args[i], "0rtt-rejected")) + else if (strcmp(args[i], "0rtt-rejected") == 0) curpx->retry_type |= PR_RE_EARLY_ERROR; - else if (!strcmp(args[i], "junk-response")) + else if (strcmp(args[i], "junk-response") == 0) curpx->retry_type |= PR_RE_JUNK_REQUEST; else if (!(strcmp(args[i], "all-retryable-errors"))) curpx->retry_type |= PR_RE_CONN_FAILED | PR_RE_DISCONNECTED | PR_RE_TIMEOUT | PR_RE_500 | PR_RE_502 | PR_RE_503 | PR_RE_504 | PR_RE_EARLY_ERROR | PR_RE_JUNK_REQUEST; - else if (!strcmp(args[i], "none")) { + else if (strcmp(args[i], "none") == 0) { if (i != 1 || *args[i + 1]) { memprintf(err, "'%s' 'none' keyworld only usable alone", args[0]); return -1; @@ -596,14 +596,14 @@ static int proxy_parse_tcpka_cnt(char **args, int section, struct proxy *proxy, return -1; } - if (!strcmp(args[0], "clitcpka-cnt")) { + if (strcmp(args[0], "clitcpka-cnt") == 0) { if (!(proxy->cap & PR_CAP_FE)) { memprintf(err, "%s will be ignored because %s '%s' has no frontend capability", args[0], proxy_type_str(proxy), proxy->id); retval = 1; } proxy->clitcpka_cnt = tcpka_cnt; - } else if (!strcmp(args[0], "srvtcpka-cnt")) { + } else if (strcmp(args[0], "srvtcpka-cnt") == 0) { if (!(proxy->cap & PR_CAP_BE)) { memprintf(err, "%s will be ignored because %s '%s' has no backend capability", args[0], proxy_type_str(proxy), proxy->id); @@ -652,14 +652,14 @@ static int proxy_parse_tcpka_idle(char **args, int section, struct proxy *proxy, return -1; } - if (!strcmp(args[0], "clitcpka-idle")) { + if (strcmp(args[0], "clitcpka-idle") == 0) { if (!(proxy->cap & PR_CAP_FE)) { memprintf(err, "%s will be ignored because %s '%s' has no frontend capability", args[0], proxy_type_str(proxy), proxy->id); retval = 1; } proxy->clitcpka_idle = tcpka_idle; - } else if (!strcmp(args[0], "srvtcpka-idle")) { + } else if (strcmp(args[0], "srvtcpka-idle") == 0) { if (!(proxy->cap & PR_CAP_BE)) { memprintf(err, "%s will be ignored because %s '%s' has no backend capability", args[0], proxy_type_str(proxy), proxy->id); @@ -708,14 +708,14 @@ static int proxy_parse_tcpka_intvl(char **args, int section, struct proxy *proxy return -1; } - if (!strcmp(args[0], "clitcpka-intvl")) { + if (strcmp(args[0], "clitcpka-intvl") == 0) { if (!(proxy->cap & PR_CAP_FE)) { memprintf(err, "%s will be ignored because %s '%s' has no frontend capability", args[0], proxy_type_str(proxy), proxy->id); retval = 1; } proxy->clitcpka_intvl = tcpka_intvl; - } else if (!strcmp(args[0], "srvtcpka-intvl")) { + } else if (strcmp(args[0], "srvtcpka-intvl") == 0) { if (!(proxy->cap & PR_CAP_BE)) { memprintf(err, "%s will be ignored because %s '%s' has no backend capability", args[0], proxy_type_str(proxy), proxy->id); @@ -942,7 +942,7 @@ struct server *findserver(const struct proxy *px, const char *name) { return NULL; for (cursrv = px->srv; cursrv; cursrv = cursrv->next) { - if (strcmp(cursrv->id, name)) + if (strcmp(cursrv->id, name) != 0) continue; if (!target) { @@ -1443,7 +1443,7 @@ int stream_set_backend(struct stream *s, struct proxy *be) &s->si[0].wait_event); if (conn_upgrade_mux_fe(conn, cs, &s->req.buf, ist(""), PROTO_MODE_HTTP) == -1) return 0; - if (!strcmp(conn->mux->name, "H2")) { + if (strcmp(conn->mux->name, "H2") == 0) { /* For HTTP/2, destroy the conn_stream, * disable logging, and pretend that we * failed, to that the stream is diff --git a/src/sample.c b/src/sample.c index f70797dae2..21070e1cff 100644 --- a/src/sample.c +++ b/src/sample.c @@ -1290,7 +1290,7 @@ int smp_resolve_args(struct proxy *p) } if (p->uri_auth && p->uri_auth->userlist && - !strcmp(p->uri_auth->userlist->name, arg->data.str.area)) + strcmp(p->uri_auth->userlist->name, arg->data.str.area) == 0) ul = p->uri_auth->userlist; else ul = auth_find_userlist(arg->data.str.area); diff --git a/src/server.c b/src/server.c index 8906f0cf7d..50c6da1317 100644 --- a/src/server.c +++ b/src/server.c @@ -466,7 +466,7 @@ static int srv_parse_namespace(char **args, int *cur_arg, return ERR_ALERT | ERR_FATAL; } - if (!strcmp(arg, "*")) { + if (strcmp(arg, "*") == 0) { /* Use the namespace associated with the connection (if present). */ newsrv->flags |= SRV_F_USE_NS_FROM_PP; return 0; @@ -575,25 +575,25 @@ static int srv_parse_proxy_v2_options(char **args, int *cur_arg, n = strchr(p, ','); if (n) *n++ = '\0'; - if (!strcmp(p, "ssl")) { + if (strcmp(p, "ssl") == 0) { newsrv->pp_opts |= SRV_PP_V2_SSL; - } else if (!strcmp(p, "cert-cn")) { + } else if (strcmp(p, "cert-cn") == 0) { newsrv->pp_opts |= SRV_PP_V2_SSL; newsrv->pp_opts |= SRV_PP_V2_SSL_CN; - } else if (!strcmp(p, "cert-key")) { + } else if (strcmp(p, "cert-key") == 0) { newsrv->pp_opts |= SRV_PP_V2_SSL; newsrv->pp_opts |= SRV_PP_V2_SSL_KEY_ALG; - } else if (!strcmp(p, "cert-sig")) { + } else if (strcmp(p, "cert-sig") == 0) { newsrv->pp_opts |= SRV_PP_V2_SSL; newsrv->pp_opts |= SRV_PP_V2_SSL_SIG_ALG; - } else if (!strcmp(p, "ssl-cipher")) { + } else if (strcmp(p, "ssl-cipher") == 0) { newsrv->pp_opts |= SRV_PP_V2_SSL; newsrv->pp_opts |= SRV_PP_V2_SSL_CIPHER; - } else if (!strcmp(p, "authority")) { + } else if (strcmp(p, "authority") == 0) { newsrv->pp_opts |= SRV_PP_V2_AUTHORITY; - } else if (!strcmp(p, "crc32c")) { + } else if (strcmp(p, "crc32c") == 0) { newsrv->pp_opts |= SRV_PP_V2_CRC32C; - } else if (!strcmp(p, "unique-id")) { + } else if (strcmp(p, "unique-id") == 0) { newsrv->pp_opts |= SRV_PP_V2_UNIQUE_ID; } else goto fail; @@ -617,13 +617,13 @@ static int srv_parse_observe(char **args, int *cur_arg, return ERR_ALERT | ERR_FATAL; } - if (!strcmp(arg, "none")) { + if (strcmp(arg, "none") == 0) { newsrv->observe = HANA_OBS_NONE; } - else if (!strcmp(arg, "layer4")) { + else if (strcmp(arg, "layer4") == 0) { newsrv->observe = HANA_OBS_LAYER4; } - else if (!strcmp(arg, "layer7")) { + else if (strcmp(arg, "layer7") == 0) { if (curproxy->mode != PR_MODE_HTTP) { memprintf(err, "'%s' can only be used in http proxies.\n", arg); return ERR_ALERT; @@ -711,18 +711,18 @@ static int srv_parse_source(char **args, int *cur_arg, *cur_arg += 2; while (*(args[*cur_arg])) { - if (!strcmp(args[*cur_arg], "usesrc")) { /* address to use outside */ + if (strcmp(args[*cur_arg], "usesrc") == 0) { /* address to use outside */ #if defined(CONFIG_HAP_TRANSPARENT) if (!*args[*cur_arg + 1]) { ha_alert("'usesrc' expects [:], 'client', 'clientip', " "or 'hdr_ip(name,#)' as argument.\n"); goto err; } - if (!strcmp(args[*cur_arg + 1], "client")) { + if (strcmp(args[*cur_arg + 1], "client") == 0) { newsrv->conn_src.opts &= ~CO_SRC_TPROXY_MASK; newsrv->conn_src.opts |= CO_SRC_TPROXY_CLI; } - else if (!strcmp(args[*cur_arg + 1], "clientip")) { + else if (strcmp(args[*cur_arg + 1], "clientip") == 0) { newsrv->conn_src.opts &= ~CO_SRC_TPROXY_MASK; newsrv->conn_src.opts |= CO_SRC_TPROXY_CIP; } @@ -790,7 +790,7 @@ static int srv_parse_source(char **args, int *cur_arg, #endif /* defined(CONFIG_HAP_TRANSPARENT) */ } /* "usesrc" */ - if (!strcmp(args[*cur_arg], "interface")) { /* specifically bind to this interface */ + if (strcmp(args[*cur_arg], "interface") == 0) { /* specifically bind to this interface */ #ifdef SO_BINDTODEVICE if (!*args[*cur_arg + 1]) { ha_alert("'%s' : missing interface name.\n", args[0]); @@ -1944,13 +1944,13 @@ int parse_server(const char *file, int linenum, char **args, struct proxy *curpr unsigned val; char *fqdn = NULL; - if (!strcmp(args[0], "server") || - !strcmp(args[0], "peer") || - !strcmp(args[0], "default-server") || - !strcmp(args[0], "server-template")) { + if (strcmp(args[0], "server") == 0 || + strcmp(args[0], "peer") == 0 || + strcmp(args[0], "default-server") == 0 || + strcmp(args[0], "server-template") == 0) { int cur_arg; int defsrv = (*args[0] == 'd'); - int srv = !defsrv && (*args[0] == 'p' || !strcmp(args[0], "server")); + int srv = !defsrv && (*args[0] == 'p' || strcmp(args[0], "server") == 0); int srv_tmpl = !defsrv && !srv; int tmpl_range_low = 0, tmpl_range_high = 0; @@ -2109,7 +2109,7 @@ int parse_server(const char *file, int linenum, char **args, struct proxy *curpr } while (*args[cur_arg]) { - if (!strcmp(args[cur_arg], "init-addr")) { + if (strcmp(args[cur_arg], "init-addr") == 0) { char *p, *end; int done; struct sockaddr_storage sa; @@ -2124,13 +2124,13 @@ int parse_server(const char *file, int linenum, char **args, struct proxy *curpr *(end++) = 0; memset(&sa, 0, sizeof(sa)); - if (!strcmp(p, "libc")) { + if (strcmp(p, "libc") == 0) { done = srv_append_initaddr(&newsrv->init_addr_methods, SRV_IADDR_LIBC); } - else if (!strcmp(p, "last")) { + else if (strcmp(p, "last") == 0) { done = srv_append_initaddr(&newsrv->init_addr_methods, SRV_IADDR_LAST); } - else if (!strcmp(p, "none")) { + else if (strcmp(p, "none") == 0) { done = srv_append_initaddr(&newsrv->init_addr_methods, SRV_IADDR_NONE); } else if (str2ip2(p, &sa, 0)) { @@ -2158,12 +2158,12 @@ int parse_server(const char *file, int linenum, char **args, struct proxy *curpr } cur_arg += 2; } - else if (!strcmp(args[cur_arg], "resolvers")) { + else if (strcmp(args[cur_arg], "resolvers") == 0) { free(newsrv->resolvers_id); newsrv->resolvers_id = strdup(args[cur_arg + 1]); cur_arg += 2; } - else if (!strcmp(args[cur_arg], "resolve-opts")) { + else if (strcmp(args[cur_arg], "resolve-opts") == 0) { char *p, *end; for (p = args[cur_arg + 1]; *p; p = end) { @@ -2172,13 +2172,13 @@ int parse_server(const char *file, int linenum, char **args, struct proxy *curpr if (*end) *(end++) = 0; - if (!strcmp(p, "allow-dup-ip")) { + if (strcmp(p, "allow-dup-ip") == 0) { newsrv->dns_opts.accept_duplicate_ip = 1; } - else if (!strcmp(p, "ignore-weight")) { + else if (strcmp(p, "ignore-weight") == 0) { newsrv->dns_opts.ignore_weight = 1; } - else if (!strcmp(p, "prevent-dup-ip")) { + else if (strcmp(p, "prevent-dup-ip") == 0) { newsrv->dns_opts.accept_duplicate_ip = 0; } else { @@ -2191,10 +2191,10 @@ int parse_server(const char *file, int linenum, char **args, struct proxy *curpr cur_arg += 2; } - else if (!strcmp(args[cur_arg], "resolve-prefer")) { - if (!strcmp(args[cur_arg + 1], "ipv4")) + else if (strcmp(args[cur_arg], "resolve-prefer") == 0) { + if (strcmp(args[cur_arg + 1], "ipv4") == 0) newsrv->dns_opts.family_prio = AF_INET; - else if (!strcmp(args[cur_arg + 1], "ipv6")) + else if (strcmp(args[cur_arg + 1], "ipv6") == 0) newsrv->dns_opts.family_prio = AF_INET6; else { ha_alert("parsing [%s:%d]: '%s' expects either ipv4 or ipv6 as argument.\n", @@ -2204,7 +2204,7 @@ int parse_server(const char *file, int linenum, char **args, struct proxy *curpr } cur_arg += 2; } - else if (!strcmp(args[cur_arg], "resolve-net")) { + else if (strcmp(args[cur_arg], "resolve-net") == 0) { char *p, *e; unsigned char mask; struct dns_options *opt; @@ -2260,7 +2260,7 @@ int parse_server(const char *file, int linenum, char **args, struct proxy *curpr cur_arg += 2; } - else if (!strcmp(args[cur_arg], "weight")) { + else if (strcmp(args[cur_arg], "weight") == 0) { int w; w = atol(args[cur_arg + 1]); if (w < 0 || w > SRV_UWGHT_MAX) { @@ -2272,10 +2272,10 @@ int parse_server(const char *file, int linenum, char **args, struct proxy *curpr newsrv->uweight = newsrv->iweight = w; cur_arg += 2; } - else if (!strcmp(args[cur_arg], "log-proto")) { - if (!strcmp(args[cur_arg + 1], "legacy")) + else if (strcmp(args[cur_arg], "log-proto") == 0) { + if (strcmp(args[cur_arg + 1], "legacy") == 0) newsrv->log_proto = SRV_LOG_PROTO_LEGACY; - else if (!strcmp(args[cur_arg + 1], "octet-count")) + else if (strcmp(args[cur_arg + 1], "octet-count") == 0) newsrv->log_proto = SRV_LOG_PROTO_OCTET_COUNTING; else { ha_alert("parsing [%s:%d]: '%s' expects one of 'legacy' or " @@ -2286,19 +2286,19 @@ int parse_server(const char *file, int linenum, char **args, struct proxy *curpr } cur_arg += 2; } - else if (!strcmp(args[cur_arg], "minconn")) { + else if (strcmp(args[cur_arg], "minconn") == 0) { newsrv->minconn = atol(args[cur_arg + 1]); cur_arg += 2; } - else if (!strcmp(args[cur_arg], "maxconn")) { + else if (strcmp(args[cur_arg], "maxconn") == 0) { newsrv->maxconn = atol(args[cur_arg + 1]); cur_arg += 2; } - else if (!strcmp(args[cur_arg], "maxqueue")) { + else if (strcmp(args[cur_arg], "maxqueue") == 0) { newsrv->maxqueue = atol(args[cur_arg + 1]); cur_arg += 2; } - else if (!strcmp(args[cur_arg], "slowstart")) { + else if (strcmp(args[cur_arg], "slowstart") == 0) { /* slowstart is stored in seconds */ const char *err = parse_time_err(args[cur_arg + 1], &val, TIME_UNIT_MS); @@ -2323,14 +2323,14 @@ int parse_server(const char *file, int linenum, char **args, struct proxy *curpr newsrv->slowstart = (val + 999) / 1000; cur_arg += 2; } - else if (!strcmp(args[cur_arg], "on-error")) { - if (!strcmp(args[cur_arg + 1], "fastinter")) + else if (strcmp(args[cur_arg], "on-error") == 0) { + if (strcmp(args[cur_arg + 1], "fastinter") == 0) newsrv->onerror = HANA_ONERR_FASTINTER; - else if (!strcmp(args[cur_arg + 1], "fail-check")) + else if (strcmp(args[cur_arg + 1], "fail-check") == 0) newsrv->onerror = HANA_ONERR_FAILCHK; - else if (!strcmp(args[cur_arg + 1], "sudden-death")) + else if (strcmp(args[cur_arg + 1], "sudden-death") == 0) newsrv->onerror = HANA_ONERR_SUDDTH; - else if (!strcmp(args[cur_arg + 1], "mark-down")) + else if (strcmp(args[cur_arg + 1], "mark-down") == 0) newsrv->onerror = HANA_ONERR_MARKDWN; else { ha_alert("parsing [%s:%d]: '%s' expects one of 'fastinter', " @@ -2342,8 +2342,8 @@ int parse_server(const char *file, int linenum, char **args, struct proxy *curpr cur_arg += 2; } - else if (!strcmp(args[cur_arg], "on-marked-down")) { - if (!strcmp(args[cur_arg + 1], "shutdown-sessions")) + else if (strcmp(args[cur_arg], "on-marked-down") == 0) { + if (strcmp(args[cur_arg + 1], "shutdown-sessions") == 0) newsrv->onmarkeddown = HANA_ONMARKEDDOWN_SHUTDOWNSESSIONS; else { ha_alert("parsing [%s:%d]: '%s' expects 'shutdown-sessions' but got '%s'\n", @@ -2354,8 +2354,8 @@ int parse_server(const char *file, int linenum, char **args, struct proxy *curpr cur_arg += 2; } - else if (!strcmp(args[cur_arg], "on-marked-up")) { - if (!strcmp(args[cur_arg + 1], "shutdown-backup-sessions")) + else if (strcmp(args[cur_arg], "on-marked-up") == 0) { + if (strcmp(args[cur_arg + 1], "shutdown-backup-sessions") == 0) newsrv->onmarkedup = HANA_ONMARKEDUP_SHUTDOWNBACKUPSESSIONS; else { ha_alert("parsing [%s:%d]: '%s' expects 'shutdown-backup-sessions' but got '%s'\n", @@ -2366,7 +2366,7 @@ int parse_server(const char *file, int linenum, char **args, struct proxy *curpr cur_arg += 2; } - else if (!strcmp(args[cur_arg], "error-limit")) { + else if (strcmp(args[cur_arg], "error-limit") == 0) { if (!*args[cur_arg + 1]) { ha_alert("parsing [%s:%d]: '%s' expects an integer argument.\n", file, linenum, args[cur_arg]); @@ -2384,7 +2384,7 @@ int parse_server(const char *file, int linenum, char **args, struct proxy *curpr } cur_arg += 2; } - else if (!strcmp(args[cur_arg], "usesrc")) { /* address to use outside: needs "source" first */ + else if (strcmp(args[cur_arg], "usesrc") == 0) { /* address to use outside: needs "source" first */ ha_alert("parsing [%s:%d] : '%s' only allowed after a '%s' statement.\n", file, linenum, "usesrc", "source"); err_code |= ERR_ALERT | ERR_FATAL; @@ -2910,11 +2910,11 @@ static void srv_update_state(struct server *srv, int version, char **params) server_recalc_eweight(srv, 1); /* load server IP address */ - if (strcmp(params[0], "-")) + if (strcmp(params[0], "-") != 0) srv->lastaddr = strdup(params[0]); if (fqdn && srv->hostname) { - if (!strcmp(srv->hostname, fqdn)) { + if (strcmp(srv->hostname, fqdn) == 0) { /* Here we reset the 'set from stats socket FQDN' flag * to support such transitions: * Let's say initial FQDN value is foo1 (in configuration file). @@ -4081,7 +4081,7 @@ int srv_set_fqdn(struct server *srv, const char *hostname, int dns_locked) resolution = srv->dns_requester->resolution; if (resolution && resolution->hostname_dn && - !strcmp(resolution->hostname_dn, hostname_dn)) + strcmp(resolution->hostname_dn, hostname_dn) == 0) goto end; dns_unlink_resolution(srv->dns_requester); @@ -4256,7 +4256,7 @@ const char *update_server_fqdn(struct server *server, const char *fqdn, const ch msg = get_trash_chunk(); chunk_reset(msg); - if (server->hostname && !strcmp(fqdn, server->hostname)) { + if (server->hostname && strcmp(fqdn, server->hostname) == 0) { chunk_appendf(msg, "no need to change the FDQN"); goto out; } diff --git a/src/ssl_ckch.c b/src/ssl_ckch.c index 4a85a5dc68..dafe59eaf1 100644 --- a/src/ssl_ckch.c +++ b/src/ssl_ckch.c @@ -279,7 +279,7 @@ int ssl_sock_load_files_into_ckch(const char *path, struct cert_key_and_chain *c /* look for the extension */ if ((ext = strrchr(fp->area, '.'))) { - if (!strcmp(ext, ".crt")) { + if (strcmp(ext, ".crt") == 0) { *ext = '\0'; fp->data = strlen(fp->area); } @@ -1220,7 +1220,7 @@ static int cli_parse_show_cert(char **args, char *payload, struct appctx *appctx ckchs = ckchs_transaction.new_ckchs; - if (strcmp(args[3] + 1, ckchs->path)) + if (strcmp(args[3] + 1, ckchs->path) != 0) goto error; } else { @@ -1541,7 +1541,7 @@ static int cli_parse_set_cert(char **args, char *payload, struct appctx *appctx, /* check which type of file we want to update */ for (i = 0; cert_exts[i].type < CERT_TYPE_MAX; i++) { end = strrchr(buf->area, '.'); - if (end && *cert_exts[i].ext && (!strcmp(end + 1, cert_exts[i].ext))) { + if (end && *cert_exts[i].ext && (strcmp(end + 1, cert_exts[i].ext) == 0)) { *end = '\0'; buf->data = strlen(buf->area); type = cert_exts[i].type; diff --git a/src/ssl_crtlist.c b/src/ssl_crtlist.c index 5002c0b573..c51fa1179b 100644 --- a/src/ssl_crtlist.c +++ b/src/ssl_crtlist.c @@ -684,7 +684,7 @@ int crtlist_load_cert_dir(char *path, struct bind_conf *bind_conf, struct crtlis struct dirent *de = de_list[i]; end = strrchr(de->d_name, '.'); - if (end && (!strcmp(end, ".issuer") || !strcmp(end, ".ocsp") || !strcmp(end, ".sctl") || !strcmp(end, ".key"))) + if (end && (strcmp(end, ".issuer") == 0 || strcmp(end, ".ocsp") == 0 || strcmp(end, ".sctl") == 0 || strcmp(end, ".key") == 0)) goto ignore_entry; snprintf(fp, sizeof(fp), "%s/%s", path, de->d_name); @@ -985,7 +985,7 @@ static int cli_parse_dump_crtlist(char **args, char *payload, struct appctx *app appctx->ctx.cli.p0 = NULL; appctx->ctx.cli.p1 = NULL; - if (*args[3] && !strcmp(args[3], "-n")) { + if (*args[3] && strcmp(args[3], "-n") == 0) { mode = 's'; filename = args[4]; } else { diff --git a/src/ssl_sock.c b/src/ssl_sock.c index 35298d5305..a5b854dce3 100644 --- a/src/ssl_sock.c +++ b/src/ssl_sock.c @@ -2490,7 +2490,7 @@ int ssl_sock_switchctx_cbk(SSL *ssl, int *al, void *arg) /* If this is a wildcard, look for an exclusion on the same crt-list line */ sni = container_of(n, struct sni_ctx, name); list_for_each_entry(sni_tmp, &sni->ckch_inst->sni_ctx, by_ckch_inst) { - if (sni_tmp->neg && (!strcmp((const char *)sni_tmp->name.key, trash.area))) { + if (sni_tmp->neg && (strcmp((const char *)sni_tmp->name.key, trash.area) == 0)) { skip = 1; break; } diff --git a/src/stats.c b/src/stats.c index f597c1073b..e2d37779bf 100644 --- a/src/stats.c +++ b/src/stats.c @@ -2501,7 +2501,7 @@ int stats_dump_proxy_to_buffer(struct stream_interface *si, struct htx *htx, break; /* match '.' which means 'self' proxy */ - if (!strcmp(scope->px_id, ".") && px == s->be) + if (strcmp(scope->px_id, ".") == 0 && px == s->be) break; scope = scope->next; } @@ -4319,12 +4319,12 @@ static int cli_parse_show_stat(char **args, char *payload, struct appctx *appctx /* proxy is the default domain */ appctx->ctx.stats.domain = STATS_DOMAIN_PROXY; - if (!strcmp(args[arg], "domain")) { + if (strcmp(args[arg], "domain") == 0) { ++args; - if (!strcmp(args[arg], "proxy")) { + if (strcmp(args[arg], "proxy") == 0) { ++args; - } else if (!strcmp(args[arg], "dns")) { + } else if (strcmp(args[arg], "dns") == 0) { appctx->ctx.stats.domain = STATS_DOMAIN_DNS; ++args; } else { diff --git a/src/stick_table.c b/src/stick_table.c index 825005c2eb..da07b8c839 100644 --- a/src/stick_table.c +++ b/src/stick_table.c @@ -71,7 +71,7 @@ struct stktable *stktable_find_by_name(const char *name) node = ebis_lookup(&stktable_by_name, name); if (node) { t = container_of(node, struct stktable, name); - if (!strcmp(t->id, name)) + if (strcmp(t->id, name) == 0) return t; } diff --git a/src/tcp_act.c b/src/tcp_act.c index 9179a80d05..0c6b7233a0 100644 --- a/src/tcp_act.c +++ b/src/tcp_act.c @@ -259,13 +259,13 @@ static enum act_parse_ret tcp_parse_set_src_dst(const char **args, int *orig_arg rule->arg.expr = expr; rule->action = ACT_CUSTOM; - if (!strcmp(args[*orig_arg-1], "set-src")) { + if (strcmp(args[*orig_arg - 1], "set-src") == 0) { rule->action_ptr = tcp_action_req_set_src; - } else if (!strcmp(args[*orig_arg-1], "set-src-port")) { + } else if (strcmp(args[*orig_arg - 1], "set-src-port") == 0) { rule->action_ptr = tcp_action_req_set_src_port; - } else if (!strcmp(args[*orig_arg-1], "set-dst")) { + } else if (strcmp(args[*orig_arg - 1], "set-dst") == 0) { rule->action_ptr = tcp_action_req_set_dst; - } else if (!strcmp(args[*orig_arg-1], "set-dst-port")) { + } else if (strcmp(args[*orig_arg - 1], "set-dst-port") == 0) { rule->action_ptr = tcp_action_req_set_dst_port; } else { return ACT_RET_PRS_ERR; diff --git a/src/tcp_rules.c b/src/tcp_rules.c index d5fce268bd..c89c2fbcb2 100644 --- a/src/tcp_rules.c +++ b/src/tcp_rules.c @@ -741,12 +741,12 @@ static int tcp_parse_request_rule(char **args, int arg, int section_type, return -1; } - if (!strcmp(args[arg], "accept")) { + if (strcmp(args[arg], "accept") == 0) { arg++; rule->action = ACT_ACTION_ALLOW; rule->flags |= ACT_FLAG_FINAL; } - else if (!strcmp(args[arg], "reject")) { + else if (strcmp(args[arg], "reject") == 0) { arg++; rule->action = ACT_ACTION_DENY; rule->flags |= ACT_FLAG_FINAL; @@ -1118,7 +1118,7 @@ static int tcp_parse_tcp_req(char **args, int section_type, struct proxy *curpx, return -1; } - if (!strcmp(args[1], "inspect-delay")) { + if (strcmp(args[1], "inspect-delay") == 0) { if (curpx == defpx) { memprintf(err, "%s %s is not allowed in 'defaults' sections", args[0], args[1]); diff --git a/src/uri_auth.c b/src/uri_auth.c index 27cb66e45b..db7e6c68da 100644 --- a/src/uri_auth.c +++ b/src/uri_auth.c @@ -238,7 +238,7 @@ struct uri_auth *stats_add_auth(struct uri_auth **root, char *user) return NULL; for (newuser = u->userlist->users; newuser; newuser = newuser->next) - if (!strcmp(newuser->user, user)) { + if (strcmp(newuser->user, user) == 0) { ha_warning("uri auth: ignoring duplicated user '%s'.\n", user); return u; @@ -284,7 +284,7 @@ struct uri_auth *stats_add_scope(struct uri_auth **root, char *scope) scope_list = &u->scope; while ((old_scope = *scope_list)) { - if (!strcmp(old_scope->px_id, scope)) + if (strcmp(old_scope->px_id, scope) == 0) break; scope_list = &old_scope->next; }