Compare the various `cmp()` functions against zero.
---
contrib/mod_defender/spoa.c | 8 ++++----
contrib/mod_defender/standalone.c | 18 +++++++++---------
contrib/modsecurity/spoa.c | 8 ++++----
.../prometheus-exporter/service-prometheus.c | 12 ++++++------
contrib/spoa_example/spoa.c | 8 ++++----
5 files changed, 27 insertions(+), 27 deletions(-)
diff --git a/contrib/mod_defender/spoa.c b/contrib/mod_defender/spoa.c
index 2ae1a366c..78c009e2e 100644
--- a/contrib/mod_defender/spoa.c
+++ b/contrib/mod_defender/spoa.c
@@ -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);
diff --git a/contrib/mod_defender/standalone.c
b/contrib/mod_defender/standalone.c
index f926ec174..58d1940a2 100644
--- a/contrib/mod_defender/standalone.c
+++ b/contrib/mod_defender/standalone.c
@@ -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);
diff --git a/contrib/modsecurity/spoa.c b/contrib/modsecurity/spoa.c
index 1a6cd9010..b0b042ee7 100644
--- a/contrib/modsecurity/spoa.c
+++ b/contrib/modsecurity/spoa.c
@@ -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);
diff --git a/contrib/prometheus-exporter/service-prometheus.c
b/contrib/prometheus-exporter/service-prometheus.c
index b6c38eb57..c2feccc76 100644
--- a/contrib/prometheus-exporter/service-prometheus.c
+++ b/contrib/prometheus-exporter/service-prometheus.c
@@ -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;
}
diff --git a/contrib/spoa_example/spoa.c b/contrib/spoa_example/spoa.c
index 972507815..3f96d849a 100644
--- a/contrib/spoa_example/spoa.c
+++ b/contrib/spoa_example/spoa.c
@@ -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);
--
2.29.0