CLEANUP: Apply the coccinelle patch for `XXXcmp()` on contrib/
Compare the various `cmp()` functions against zero.
diff --git a/contrib/mod_defender/spoa.c b/contrib/mod_defender/spoa.c
index 2ae1a36..78c009e 100644
--- a/contrib/mod_defender/spoa.c
+++ b/contrib/mod_defender/spoa.c
@@ -1044,7 +1044,7 @@
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 @@
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);
diff --git a/contrib/mod_defender/standalone.c b/contrib/mod_defender/standalone.c
index f926ec1..58d1940 100644
--- a/contrib/mod_defender/standalone.c
+++ b/contrib/mod_defender/standalone.c
@@ -863,7 +863,7 @@
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 @@
*/
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 @@
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 @@
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 @@
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);
diff --git a/contrib/modsecurity/spoa.c b/contrib/modsecurity/spoa.c
index 1a6cd90..b0b042e 100644
--- a/contrib/modsecurity/spoa.c
+++ b/contrib/modsecurity/spoa.c
@@ -1049,7 +1049,7 @@
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 @@
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);
diff --git a/contrib/prometheus-exporter/service-prometheus.c b/contrib/prometheus-exporter/service-prometheus.c
index b6c38eb..c2feccc 100644
--- a/contrib/prometheus-exporter/service-prometheus.c
+++ b/contrib/prometheus-exporter/service-prometheus.c
@@ -2394,7 +2394,7 @@
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 @@
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;
}
diff --git a/contrib/spoa_example/spoa.c b/contrib/spoa_example/spoa.c
index 9725078..3f96d84 100644
--- a/contrib/spoa_example/spoa.c
+++ b/contrib/spoa_example/spoa.c
@@ -1100,7 +1100,7 @@
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 @@
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);