diff --git a/contrib/fuzzystrmatch/dmetaphone.c b/contrib/fuzzystrmatch/dmetaphone.c index 6721e58f220..f562f5484cc 100644 --- a/contrib/fuzzystrmatch/dmetaphone.c +++ b/contrib/fuzzystrmatch/dmetaphone.c @@ -364,7 +364,7 @@ StringAt(metastring *s, int start, int length,...) if (*test && (strncmp(pos, test, length) == 0)) return 1; } - while (strcmp(test, "")); + while (strcmp(test, "") != 0); va_end(ap); diff --git a/contrib/isn/isn.c b/contrib/isn/isn.c index b698cb00ff5..ac5f21c7d78 100644 --- a/contrib/isn/isn.c +++ b/contrib/isn/isn.c @@ -365,19 +365,19 @@ ean2isn(ean13 ean, bool errorOK, ean13 *result, enum isn_type accept) *--aux = '0'; /* fill the remaining EAN13 with '0' */ /* find out the data type: */ - if (!strncmp("978", buf, 3)) + if (strncmp("978", buf, 3) == 0) { /* ISBN */ type = ISBN; } - else if (!strncmp("977", buf, 3)) + else if (strncmp("977", buf, 3) == 0) { /* ISSN */ type = ISSN; } - else if (!strncmp("9790", buf, 4)) + else if (strncmp("9790", buf, 4) == 0) { /* ISMN */ type = ISMN; } - else if (!strncmp("979", buf, 3)) + else if (strncmp("979", buf, 3) == 0) { /* ISBN-13 */ type = ISBN; } @@ -570,28 +570,28 @@ ean2string(ean13 ean, bool errorOK, char *result, bool shortType) } /* find out what type of hyphenation is needed: */ - if (!strncmp("978-", result, search)) + if (strncmp("978-", result, search) == 0) { /* ISBN -13 978-range */ /* The string should be in this form: 978-??000000000-0" */ type = ISBN; TABLE = ISBN_range; TABLE_index = ISBN_index; } - else if (!strncmp("977-", result, search)) + else if (strncmp("977-", result, search) == 0) { /* ISSN */ /* The string should be in this form: 977-??000000000-0" */ type = ISSN; TABLE = ISSN_range; TABLE_index = ISSN_index; } - else if (!strncmp("979-0", result, search + 1)) + else if (strncmp("979-0", result, search + 1) == 0) { /* ISMN */ /* The string should be in this form: 979-0?000000000-0" */ type = ISMN; TABLE = ISMN_range; TABLE_index = ISMN_index; } - else if (!strncmp("979-", result, search)) + else if (strncmp("979-", result, search) == 0) { /* ISBN-13 979-range */ /* The string should be in this form: 979-??000000000-0" */ type = ISBN; @@ -813,13 +813,13 @@ string2ean(const char *str, bool errorOK, ean13 *result, /* now get the subtype of EAN13: */ if (buf[3] == '0') type = UPC; - else if (!strncmp("977", buf + 3, 3)) + else if (strncmp("977", buf + 3, 3) == 0) type = ISSN; - else if (!strncmp("978", buf + 3, 3)) + else if (strncmp("978", buf + 3, 3) == 0) type = ISBN; - else if (!strncmp("9790", buf + 3, 4)) + else if (strncmp("9790", buf + 3, 4) == 0) type = ISMN; - else if (!strncmp("979", buf + 3, 3)) + else if (strncmp("979", buf + 3, 3) == 0) type = ISBN; if (accept != EAN13 && accept != ANY && type != accept) goto eanwrongtype; diff --git a/contrib/pgbench/pgbench.c b/contrib/pgbench/pgbench.c index dbf53f4219e..91d86da38df 100644 --- a/contrib/pgbench/pgbench.c +++ b/contrib/pgbench/pgbench.c @@ -1579,7 +1579,7 @@ process_commands(char *buf) { if (pg_strcasecmp(my_commands->argv[2], "us") != 0 && pg_strcasecmp(my_commands->argv[2], "ms") != 0 && - pg_strcasecmp(my_commands->argv[2], "s")) + pg_strcasecmp(my_commands->argv[2], "s") != 0) { fprintf(stderr, "%s: unknown time unit '%s' - must be us, ms or s\n", my_commands->argv[0], my_commands->argv[2]); diff --git a/contrib/pgcrypto/crypt-md5.c b/contrib/pgcrypto/crypt-md5.c index 2215f38d8bf..7aa57bc319f 100644 --- a/contrib/pgcrypto/crypt-md5.c +++ b/contrib/pgcrypto/crypt-md5.c @@ -55,7 +55,7 @@ px_crypt_md5(const char *pw, const char *salt, char *passwd, unsigned dstlen) sp = salt; /* If it starts with the magic string, then skip that */ - if (!strncmp(sp, magic, strlen(magic))) + if (strncmp(sp, magic, strlen(magic)) == 0) sp += strlen(magic); /* It stops at the first '$', max 8 chars */ diff --git a/contrib/pgcrypto/internal.c b/contrib/pgcrypto/internal.c index 5ceb5271bbb..a02c943e049 100644 --- a/contrib/pgcrypto/internal.c +++ b/contrib/pgcrypto/internal.c @@ -603,7 +603,7 @@ px_find_cipher(const char *name, PX_Cipher **res) name = px_resolve_alias(int_aliases, name); for (i = 0; int_ciphers[i].name; i++) - if (!strcmp(int_ciphers[i].name, name)) + if (strcmp(int_ciphers[i].name, name) == 0) { c = int_ciphers[i].load(); break; diff --git a/contrib/pgcrypto/openssl.c b/contrib/pgcrypto/openssl.c index dc25acea5d2..ad7fb9ee0ee 100644 --- a/contrib/pgcrypto/openssl.c +++ b/contrib/pgcrypto/openssl.c @@ -953,7 +953,7 @@ px_find_cipher(const char *name, PX_Cipher **res) name = px_resolve_alias(ossl_aliases, name); for (i = ossl_cipher_types; i->name; i++) - if (!strcmp(i->name, name)) + if (strcmp(i->name, name) == 0) break; if (i->name == NULL) return PXE_NO_CIPHER; diff --git a/contrib/pgcrypto/px-crypt.c b/contrib/pgcrypto/px-crypt.c index d2e1682e159..63ec038dc54 100644 --- a/contrib/pgcrypto/px-crypt.c +++ b/contrib/pgcrypto/px-crypt.c @@ -96,7 +96,7 @@ px_crypt(const char *psw, const char *salt, char *buf, unsigned len) { if (!c->id_len) break; - if (!strncmp(salt, c->id, c->id_len)) + if (strncmp(salt, c->id, c->id_len) == 0) break; } diff --git a/contrib/pgcrypto/px.c b/contrib/pgcrypto/px.c index e3f5e262215..f23d4de5738 100644 --- a/contrib/pgcrypto/px.c +++ b/contrib/pgcrypto/px.c @@ -360,7 +360,7 @@ parse_cipher_name(char *full, char **cipher, char **pad) if (p2 != NULL) { *p2++ = 0; - if (!strcmp(p, "pad")) + if (strcmp(p, "pad") == 0) *pad = p2; else return PXE_BAD_OPTION; @@ -405,9 +405,9 @@ px_find_combo(const char *name, PX_Combo **res) if (s_pad != NULL) { - if (!strcmp(s_pad, "pkcs")) + if (strcmp(s_pad, "pkcs") == 0) cx->padding = 1; - else if (!strcmp(s_pad, "none")) + else if (strcmp(s_pad, "none") == 0) cx->padding = 0; else goto err1; diff --git a/src/backend/libpq/auth.c b/src/backend/libpq/auth.c index ca2bba99d8c..d94b483dc16 100644 --- a/src/backend/libpq/auth.c +++ b/src/backend/libpq/auth.c @@ -1464,7 +1464,7 @@ pg_SSPI_recvauth(Port *port) */ if (port->hba->krb_realm && strlen(port->hba->krb_realm)) { - if (pg_strcasecmp(port->hba->krb_realm, domainname)) + if (pg_strcasecmp(port->hba->krb_realm, domainname) != 0) { elog(DEBUG2, "SSPI domain (%s) and configured domain (%s) don't match", diff --git a/src/backend/utils/adt/formatting.c b/src/backend/utils/adt/formatting.c index be0966ca90e..96c89931b50 100644 --- a/src/backend/utils/adt/formatting.c +++ b/src/backend/utils/adt/formatting.c @@ -1012,7 +1012,7 @@ index_seq_search(char *str, const KeyWord *kw, const int *index) do { - if (!strncmp(str, k->name, k->len)) + if (strncmp(str, k->name, k->len) == 0) return k; k++; if (!k->name) @@ -1032,7 +1032,7 @@ suff_search(char *str, KeySuffix *suf, int type) if (s->type != type) continue; - if (!strncmp(str, s->name, s->len)) + if (strncmp(str, s->name, s->len) == 0) return s; } return NULL; diff --git a/src/bin/initdb/initdb.c b/src/bin/initdb/initdb.c index c0f57f25cb7..a12d9b162cf 100644 --- a/src/bin/initdb/initdb.c +++ b/src/bin/initdb/initdb.c @@ -1098,7 +1098,7 @@ setup_config(void) conflines = replace_token(conflines, "@authcomment@", - strcmp(authmethod, "trust") ? "" : AUTHTRUST_WARNING); + strcmp(authmethod, "trust") != 0 ? "" : AUTHTRUST_WARNING); /* Replace username for replication */ conflines = replace_token(conflines, @@ -2667,16 +2667,16 @@ main(int argc, char *argv[]) authmethod = "trust"; } - if (strcmp(authmethod, "md5") && - strcmp(authmethod, "peer") && - strcmp(authmethod, "ident") && - strcmp(authmethod, "trust") && + if (strcmp(authmethod, "md5") != 0 && + strcmp(authmethod, "peer") != 0 && + strcmp(authmethod, "ident") != 0 && + strcmp(authmethod, "trust") != 0 && #ifdef USE_PAM - strcmp(authmethod, "pam") && - strncmp(authmethod, "pam ", 4) && /* pam with space = param */ + strcmp(authmethod, "pam") != 0 && + strncmp(authmethod, "pam ", 4) != 0 && /* pam with space = param */ #endif - strcmp(authmethod, "crypt") && - strcmp(authmethod, "password") + strcmp(authmethod, "crypt") != 0 && + strcmp(authmethod, "password") != 0 ) /* @@ -2689,9 +2689,9 @@ main(int argc, char *argv[]) exit(1); } - if ((!strcmp(authmethod, "md5") || - !strcmp(authmethod, "crypt") || - !strcmp(authmethod, "password")) && + if ((strcmp(authmethod, "md5") == 0 || + strcmp(authmethod, "crypt") == 0 || + strcmp(authmethod, "password") == 0) && !(pwprompt || pwfilename)) { fprintf(stderr, _("%s: must specify a password for the superuser to enable %s authentication\n"), progname, authmethod); diff --git a/src/bin/pg_basebackup/pg_receivexlog.c b/src/bin/pg_basebackup/pg_receivexlog.c index b05f7dbc598..4f8e9286bf7 100644 --- a/src/bin/pg_basebackup/pg_receivexlog.c +++ b/src/bin/pg_basebackup/pg_receivexlog.c @@ -126,7 +126,7 @@ FindStreamingStart(XLogRecPtr currentpos, uint32 currenttimeline) log, seg; - if (!strcmp(dirent->d_name, ".") || !strcmp(dirent->d_name, "..")) + if (strcmp(dirent->d_name, ".") == 0 || strcmp(dirent->d_name, "..") == 0) continue; /* xlog files are always 24 characters */ diff --git a/src/bin/pg_ctl/pg_ctl.c b/src/bin/pg_ctl/pg_ctl.c index 0cc43b3fe99..5b48bd99207 100644 --- a/src/bin/pg_ctl/pg_ctl.c +++ b/src/bin/pg_ctl/pg_ctl.c @@ -1263,7 +1263,7 @@ pgwin32_CommandLine(bool registration) if (registration) { - if (pg_strcasecmp(cmdLine + strlen(cmdLine) - 4, ".exe")) + if (pg_strcasecmp(cmdLine + strlen(cmdLine) - 4, ".exe") != 0) { /* If commandline does not end in .exe, append it */ strcat(cmdLine, ".exe"); @@ -1841,25 +1841,24 @@ set_mode(char *modeopt) static void set_sig(char *signame) { - if (!strcmp(signame, "HUP")) + if (strcmp(signame, "HUP") == 0) sig = SIGHUP; - else if (!strcmp(signame, "INT")) + else if (strcmp(signame, "INT") == 0) sig = SIGINT; - else if (!strcmp(signame, "QUIT")) + else if (strcmp(signame, "QUIT") == 0) sig = SIGQUIT; - else if (!strcmp(signame, "ABRT")) + else if (strcmp(signame, "ABRT") == 0) sig = SIGABRT; - - /* - * probably should NOT provide SIGKILL - * - * else if (!strcmp(signame,"KILL")) sig = SIGKILL; - */ - else if (!strcmp(signame, "TERM")) +#if 0 + /* probably should NOT provide SIGKILL */ + else if (strcmp(signame,"KILL") == 0) + sig = SIGKILL; +#endif + else if (strcmp(signame, "TERM") == 0) sig = SIGTERM; - else if (!strcmp(signame, "USR1")) + else if (strcmp(signame, "USR1") == 0) sig = SIGUSR1; - else if (!strcmp(signame, "USR2")) + else if (strcmp(signame, "USR2") == 0) sig = SIGUSR2; else { diff --git a/src/bin/pg_dump/pg_dump.c b/src/bin/pg_dump/pg_dump.c index 89a8a23599f..436a9df4ac8 100644 --- a/src/bin/pg_dump/pg_dump.c +++ b/src/bin/pg_dump/pg_dump.c @@ -14384,7 +14384,7 @@ myFormatType(const char *typname, int32 typmod) } /* Show lengths on bpchar and varchar */ - if (!strcmp(typname, "bpchar")) + if (strcmp(typname, "bpchar") == 0) { int len = (typmod - VARHDRSZ); @@ -14393,14 +14393,14 @@ myFormatType(const char *typname, int32 typmod) appendPQExpBuffer(buf, "(%d)", typmod - VARHDRSZ); } - else if (!strcmp(typname, "varchar")) + else if (strcmp(typname, "varchar") == 0) { appendPQExpBuffer(buf, "character varying"); if (typmod != -1) appendPQExpBuffer(buf, "(%d)", typmod - VARHDRSZ); } - else if (!strcmp(typname, "numeric")) + else if (strcmp(typname, "numeric") == 0) { appendPQExpBuffer(buf, "numeric"); if (typmod != -1) diff --git a/src/bin/psql/tab-complete.c b/src/bin/psql/tab-complete.c index 473706246d0..61779c69633 100644 --- a/src/bin/psql/tab-complete.c +++ b/src/bin/psql/tab-complete.c @@ -2368,7 +2368,7 @@ psql_completion(char *text, int start, int end) /* Complete LOCK [TABLE]