CLEANUP: Apply the coccinelle patch for XXXcmp() on contrib/

Compare the various `cmp()` functions against zero.
This commit is contained in:
Tim Duesterhus 2021-01-02 22:31:55 +01:00 committed by Willy Tarreau
parent 54182ec9d7
commit 8cb12a8292
5 changed files with 27 additions and 27 deletions

View File

@ -1044,7 +1044,7 @@ use_spoe_engine(struct client *client)
return;
list_for_each_entry(eng, &client->worker->engines, list) {
if (!strcmp(eng->id, client->engine_id))
if (strcmp(eng->id, client->engine_id) == 0)
goto end;
}
@ -1749,11 +1749,11 @@ main(int argc, char **argv)
server_port = atoi(optarg);
break;
case 'c':
if (!strcmp(optarg, "pipelining"))
if (strcmp(optarg, "pipelining") == 0)
pipelining = true;
else if (!strcmp(optarg, "async"))
else if (strcmp(optarg, "async") == 0)
async = true;
else if (!strcmp(optarg, "fragmentation"))
else if (strcmp(optarg, "fragmentation") == 0)
fragmentation = true;
else
fprintf(stderr, "WARNING: unsupported capability '%s'\n", optarg);

View File

@ -863,7 +863,7 @@ static const command_rec *find_command(const char *name,
const command_rec *cmds)
{
while (cmds->name) {
if (!strcasecmp(name, cmds->name))
if (strcasecmp(name, cmds->name) == 0)
return cmds;
++cmds;
}
@ -1044,7 +1044,7 @@ static const char *invoke_cmd(const command_rec *cmd, cmd_parms *parms,
*/
w = getword_conf(parms->temp_pool, &args);
if (*w == '\0' || (strcasecmp(w, "on") && strcasecmp(w, "off")))
if (*w == '\0' || (strcasecmp(w, "on") != 0 && strcasecmp(w, "off") != 0))
return apr_pstrcat(parms->pool, cmd->name, " must be On or Off",
NULL);
@ -1151,8 +1151,8 @@ static const char *process_resource_config_nofnmatch(const char *fname,
candidates = apr_array_make(ptemp, 1, sizeof(fnames));
while (apr_dir_read(&dirent, APR_FINFO_DIRENT, dirp) == APR_SUCCESS) {
/* strip out '.' and '..' */
if (strcmp(dirent.name, ".")
&& strcmp(dirent.name, "..")) {
if (strcmp(dirent.name, ".") != 0
&& strcmp(dirent.name, "..") != 0) {
fnew = (fnames *) apr_array_push(candidates);
fnew->fname = make_full_path(ptemp, path, dirent.name);
}
@ -1236,8 +1236,8 @@ static const char *process_resource_config_fnmatch(const char *path,
candidates = apr_array_make(ptemp, 1, sizeof(fnames));
while (apr_dir_read(&dirent, APR_FINFO_DIRENT | APR_FINFO_TYPE, dirp) == APR_SUCCESS) {
/* strip out '.' and '..' */
if (strcmp(dirent.name, ".")
&& strcmp(dirent.name, "..")
if (strcmp(dirent.name, ".") != 0
&& strcmp(dirent.name, "..") != 0
&& (apr_fnmatch(fname, dirent.name,
APR_FNM_PERIOD) == APR_SUCCESS)) {
const char *full_path = make_full_path(ptemp, path, dirent.name);
@ -1388,12 +1388,12 @@ const char *read_module_config(server_rec *s, void *mconfig,
continue;
/* similar to invoke_cmd() */
if (!strcasecmp(cmd_name, "IncludeOptional") ||
!strcasecmp(cmd_name, "Include"))
if (strcasecmp(cmd_name, "IncludeOptional") == 0 ||
strcasecmp(cmd_name, "Include") == 0)
{
char *w, *fullname;
if (!strcasecmp(cmd_name, "IncludeOptional"))
if (strcasecmp(cmd_name, "IncludeOptional") == 0)
optional = 1;
w = getword_conf(parms->pool, &args);

View File

@ -1049,7 +1049,7 @@ use_spoe_engine(struct client *client)
return;
list_for_each_entry(eng, &client->worker->engines, list) {
if (!strcmp(eng->id, client->engine_id))
if (strcmp(eng->id, client->engine_id) == 0)
goto end;
}
@ -1773,11 +1773,11 @@ main(int argc, char **argv)
configuration_file = optarg;
break;
case 'c':
if (!strcmp(optarg, "pipelining"))
if (strcmp(optarg, "pipelining") == 0)
pipelining = true;
else if (!strcmp(optarg, "async"))
else if (strcmp(optarg, "async") == 0)
async = true;
else if (!strcmp(optarg, "fragmentation"))
else if (strcmp(optarg, "fragmentation") == 0)
fragmentation = true;
else
fprintf(stderr, "WARNING: unsupported capability '%s'\n", optarg);

View File

@ -2394,7 +2394,7 @@ static int promex_parse_uri(struct appctx *appctx, struct stream_interface *si)
goto error;
}
if (!strcmp(key, "scope")) {
if (strcmp(key, "scope") == 0) {
default_scopes = 0; /* at least a scope defined, unset default scopes */
if (!value)
goto error;
@ -2402,18 +2402,18 @@ static int promex_parse_uri(struct appctx *appctx, struct stream_interface *si)
appctx->ctx.stats.flags &= ~PROMEX_FL_SCOPE_ALL;
else if (*value == '*')
appctx->ctx.stats.flags |= PROMEX_FL_SCOPE_ALL;
else if (!strcmp(value, "global"))
else if (strcmp(value, "global") == 0)
appctx->ctx.stats.flags |= PROMEX_FL_SCOPE_GLOBAL;
else if (!strcmp(value, "server"))
else if (strcmp(value, "server") == 0)
appctx->ctx.stats.flags |= PROMEX_FL_SCOPE_SERVER;
else if (!strcmp(value, "backend"))
else if (strcmp(value, "backend") == 0)
appctx->ctx.stats.flags |= PROMEX_FL_SCOPE_BACK;
else if (!strcmp(value, "frontend"))
else if (strcmp(value, "frontend") == 0)
appctx->ctx.stats.flags |= PROMEX_FL_SCOPE_FRONT;
else
goto error;
}
else if (!strcmp(key, "no-maint"))
else if (strcmp(key, "no-maint") == 0)
appctx->ctx.stats.flags |= PROMEX_FL_NO_MAINT_SRV;
}

View File

@ -1100,7 +1100,7 @@ use_spoe_engine(struct client *client)
return;
list_for_each_entry(eng, &client->worker->engines, list) {
if (!strcmp(eng->id, client->engine_id))
if (strcmp(eng->id, client->engine_id) == 0)
goto end;
}
@ -1762,11 +1762,11 @@ main(int argc, char **argv)
server_port = atoi(optarg);
break;
case 'c':
if (!strcmp(optarg, "pipelining"))
if (strcmp(optarg, "pipelining") == 0)
pipelining = true;
else if (!strcmp(optarg, "async"))
else if (strcmp(optarg, "async") == 0)
async = true;
else if (!strcmp(optarg, "fragmentation"))
else if (strcmp(optarg, "fragmentation") == 0)
fragmentation = true;
else
fprintf(stderr, "WARNING: unsupported capability '%s'\n", optarg);