git.postgresql.org Git - postgresql.git/commitdiff

git projects / postgresql.git / commitdiff
? search:
summary | shortlog | log | commit | commitdiff | tree
raw | patch | inline | side by side (parent: d383c23)
Standardize treatment of strcmp() return value
2011年12月27日 19:19:09 +0000 (21:19 +0200)
2011年12月27日 19:19:09 +0000 (21:19 +0200)
Always compare the return value to 0, don't use cute tricks like
if (!strcmp(...)).

27 files changed:

diff --git a/contrib/fuzzystrmatch/dmetaphone.c b/contrib/fuzzystrmatch/dmetaphone.c
index 6721e58f22025a26850aa84725ca0024e9c43682..f562f5484cc83114089d85a7ba7f34611b56726e 100644 (file)
--- 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 b698cb00ff5ecc8a1c49d7b1f8721bba715d5c07..ac5f21c7d783b229f017aaae9da8af0ec60e2a07 100644 (file)
--- 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 dbf53f4219ec7031b4cd1a582e5d3934b8918c3f..91d86da38df521ca053ec44a7308592dd40ee7cb 100644 (file)
--- 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 2215f38d8bf09c36e19a652de1abe872d0d1e43b..7aa57bc319fbf73c03314b8e1e35894b6ca1ef0a 100644 (file)
--- 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 5ceb5271bbbd3a7073a833010f06dcaa6b2f12e1..a02c943e0498935856ecdca2153fb8fe4d41f85c 100644 (file)
--- 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 dc25acea5d2788fd19ee672455ac95a1dedc435f..ad7fb9ee0ee53f941bcca9a5577fba977ef00116 100644 (file)
--- 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 d2e1682e15947239ce0edaf43f021dc56bdf4b71..63ec038dc549abff4fc228c446763d43dd955d93 100644 (file)
--- 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 e3f5e262215406c1762b7c8ab8b2c53ed774475e..f23d4de5738df59b1ed32d915367d324a3db681c 100644 (file)
--- 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 ca2bba99d8cfd556fd51441b9709c8e109df6dd5..d94b483dc16920db3d462bd0f5d6f7166a33b061 100644 (file)
--- 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 be0966ca90e949942a3f765da1a352d7f1527c93..96c89931b50a69b90ecce685ec95511d06f10caa 100644 (file)
--- 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 c0f57f25cb71866fcb2de20ffd47faf93d19ae56..a12d9b162cfb0f0fac00cb3c9c2b0d4c1a96ab30 100644 (file)
--- 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 b05f7dbc5983f2e800d8d5803946409996264aaf..4f8e9286bf7c461ee8fcdc57e44c470a3da04709 100644 (file)
--- 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 0cc43b3fe991b500f6997663c86e70d492aacc61..5b48bd9920724394ef781f3c3fc8a6c687616672 100644 (file)
--- 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 89a8a23599fe3193151abdf4e6081a86cf34c9c3..436a9df4ac8f6c9c7649aefc0b74967719875aaa 100644 (file)
--- 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 473706246d0be92c0984b09b2ed60132af3a4815..61779c696330eda32c07653f25affccddc9f48a4 100644 (file)
--- 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] <table> with "IN" */
else if ((pg_strcasecmp(prev2_wd, "LOCK") == 0 &&
- pg_strcasecmp(prev_wd, "TABLE")) ||
+ pg_strcasecmp(prev_wd, "TABLE") != 0) ||
(pg_strcasecmp(prev2_wd, "TABLE") == 0 &&
pg_strcasecmp(prev3_wd, "LOCK") == 0))
COMPLETE_WITH_CONST("IN");
diff --git a/src/interfaces/ecpg/ecpglib/data.c b/src/interfaces/ecpg/ecpglib/data.c
index fc0455607b753b26dba0da25bcfcd3c22070a44b..db975035df916e6dca5a3a55f28835f7cc468179 100644 (file)
--- a/src/interfaces/ecpg/ecpglib/data.c
+++ b/src/interfaces/ecpg/ecpglib/data.c
@@ -97,19 +97,19 @@ get_float8_nan(void)
static bool
check_special_value(char *ptr, double *retval, char **endptr)
{
- if (!pg_strncasecmp(ptr, "NaN", 3))
+ if (pg_strncasecmp(ptr, "NaN", 3) == 0)
{
*retval = get_float8_nan();
*endptr = ptr + 3;
return true;
}
- else if (!pg_strncasecmp(ptr, "Infinity", 8))
+ else if (pg_strncasecmp(ptr, "Infinity", 8) == 0)
{
*retval = get_float8_infinity();
*endptr = ptr + 8;
return true;
}
- else if (!pg_strncasecmp(ptr, "-Infinity", 9))
+ else if (pg_strncasecmp(ptr, "-Infinity", 9) == 0)
{
*retval = -get_float8_infinity();
*endptr = ptr + 9;
diff --git a/src/interfaces/ecpg/ecpglib/descriptor.c b/src/interfaces/ecpg/ecpglib/descriptor.c
index 17a956ea5d4100b8afdb22794a91c9a39acdda5f..1dde52c42fb75eb6049188288d93b9a97e95444a 100644 (file)
--- a/src/interfaces/ecpg/ecpglib/descriptor.c
+++ b/src/interfaces/ecpg/ecpglib/descriptor.c
@@ -652,7 +652,7 @@ ECPGdeallocate_desc(int line, const char *name)
ecpg_init_sqlca(sqlca);
for (desc = get_descriptors(), prev = NULL; desc; prev = desc, desc = desc->next)
{
- if (!strcmp(name, desc->name))
+ if (strcmp(name, desc->name) == 0)
{
if (prev)
prev->next = desc->next;
diff --git a/src/interfaces/ecpg/ecpglib/execute.c b/src/interfaces/ecpg/ecpglib/execute.c
index b8e48a366c67765ce7c4a05a781338324759f6ab..f468147b295529dc87b2e7fb063b32d4b3456007 100644 (file)
--- a/src/interfaces/ecpg/ecpglib/execute.c
+++ b/src/interfaces/ecpg/ecpglib/execute.c
@@ -1650,9 +1650,9 @@ ecpg_execute(struct statement * stmt)
ecpg_log("ecpg_execute on line %d: OK: %s\n", stmt->lineno, cmdstat);
if (stmt->compat != ECPG_COMPAT_INFORMIX_SE &&
!sqlca->sqlerrd[2] &&
- (!strncmp(cmdstat, "UPDATE", 6)
- || !strncmp(cmdstat, "INSERT", 6)
- || !strncmp(cmdstat, "DELETE", 6)))
+ (strncmp(cmdstat, "UPDATE", 6) == 0
+ || strncmp(cmdstat, "INSERT", 6) == 0
+ || strncmp(cmdstat, "DELETE", 6) == 0))
ecpg_raise(stmt->lineno, ECPG_NOT_FOUND, ECPG_SQLSTATE_NO_DATA, NULL);
break;
case PGRES_COPY_OUT:
diff --git a/src/interfaces/ecpg/ecpglib/prepare.c b/src/interfaces/ecpg/ecpglib/prepare.c
index 60c9c50b22790ef45aaacab04cf6c84cab2410da..c5a554e8e282e574502654dac2e03b679254fb4a 100644 (file)
--- a/src/interfaces/ecpg/ecpglib/prepare.c
+++ b/src/interfaces/ecpg/ecpglib/prepare.c
@@ -361,7 +361,7 @@ SearchStmtCache(const char *ecpgQuery)
{
if (stmtCacheEntries[entNo].stmtID[0]) /* check if entry is in use */
{
- if (!strcmp(ecpgQuery, stmtCacheEntries[entNo].ecpgQuery))
+ if (strcmp(ecpgQuery, stmtCacheEntries[entNo].ecpgQuery) == 0)
break; /* found it */
}
++entNo; /* incr entry # */
diff --git a/src/interfaces/ecpg/preproc/descriptor.c b/src/interfaces/ecpg/preproc/descriptor.c
index 965963de7e15c6472307ebd81a595c80595bb86e..52865293f24a536d44d8aa5bd39d7dd6e98db45a 100644 (file)
--- a/src/interfaces/ecpg/preproc/descriptor.c
+++ b/src/interfaces/ecpg/preproc/descriptor.c
@@ -106,11 +106,11 @@ drop_descriptor(char *name, char *connection)
for (i = descriptors; i; lastptr = &i->next, i = i->next)
{
- if (!strcmp(name, i->name))
+ if (strcmp(name, i->name) == 0)
{
if ((!connection && !i->connection)
|| (connection && i->connection
- && !strcmp(connection, i->connection)))
+ && strcmp(connection, i->connection) == 0))
{
*lastptr = i->next;
if (i->connection)
@@ -135,11 +135,11 @@ lookup_descriptor(char *name, char *connection)
for (i = descriptors; i; i = i->next)
{
- if (!strcmp(name, i->name))
+ if (strcmp(name, i->name) == 0)
{
if ((!connection && !i->connection)
|| (connection && i->connection
- && !strcmp(connection, i->connection)))
+ && strcmp(connection, i->connection) == 0))
return i;
}
}
diff --git a/src/interfaces/ecpg/preproc/ecpg.addons b/src/interfaces/ecpg/preproc/ecpg.addons
index 849a37cf9d5311efc0ac899b0a4924a100813644..5c5adf7699655fe09774f806499c9a156b963aff 100644 (file)
--- a/src/interfaces/ecpg/preproc/ecpg.addons
+++ b/src/interfaces/ecpg/preproc/ecpg.addons
@@ -102,7 +102,7 @@ ECPG: stmtViewStmt rule
{
const char *con = connection ? connection : "NULL";
- if (!strcmp(1,ドル "all"))
+ if (strcmp(1,ドル "all") == 0)
fprintf(yyout, "{ ECPGdeallocate_all(__LINE__, %d, %s);", compat, con);
else if (1ドル[0] == ':')
fprintf(yyout, "{ ECPGdeallocate(__LINE__, %d, %s, %s);", compat, con, 1ドル+1);
diff --git a/src/interfaces/ecpg/preproc/ecpg.header b/src/interfaces/ecpg/preproc/ecpg.header
index 1ea6ce444eaeae1831540863bfadd98a3cf146e6..94c45c88c0e7e159a0475c1c05612ddf134ea2b6 100644 (file)
--- a/src/interfaces/ecpg/preproc/ecpg.header
+++ b/src/interfaces/ecpg/preproc/ecpg.header
@@ -262,7 +262,7 @@ adjust_outofscope_cursor_vars(struct cursor *cur)
skip_set_var = true;
}
else if ((ptr->variable->type->type == ECPGt_char_variable)
- && (!strncmp(ptr->variable->name, "ECPGprepared_statement", strlen("ECPGprepared_statement"))))
+ && (strncmp(ptr->variable->name, "ECPGprepared_statement", strlen("ECPGprepared_statement")) == 0))
{
newvar = ptr->variable;
skip_set_var = true;
@@ -468,7 +468,7 @@ adjust_outofscope_cursor_vars(struct cursor *cur)
/* This tests whether the cursor was declared and opened in the same function. */
#define SAMEFUNC(cur) \
((cur->function == NULL) || \
- (cur->function != NULL && !strcmp(cur->function, current_function)))
+ (cur->function != NULL && strcmp(cur->function, current_function) == 0))
static struct cursor *
add_additional_variables(char *name, bool insert)
diff --git a/src/interfaces/ecpg/preproc/output.c b/src/interfaces/ecpg/preproc/output.c
index 9958a0a5dfed68d2a780e46920a3bc729d9b19b1..389a5272d44cce0b4dc8ec6ff16df58388783752 100644 (file)
--- a/src/interfaces/ecpg/preproc/output.c
+++ b/src/interfaces/ecpg/preproc/output.c
@@ -163,7 +163,7 @@ output_deallocate_prepare_statement(char *name)
{
const char *con = connection ? connection : "NULL";
- if (strcmp(name, "all"))
+ if (strcmp(name, "all") != 0)
{
fprintf(yyout, "{ ECPGdeallocate(__LINE__, %d, %s, ", compat, con);
output_escaped_str(name, true);
diff --git a/src/interfaces/ecpg/preproc/pgc.l b/src/interfaces/ecpg/preproc/pgc.l
index 0d1355c2cb95c42bb4114765284a5c20f11f5f50..7ca1d0ffc43906491c5a81e30cdfb51b6e1905c3 100644 (file)
--- a/src/interfaces/ecpg/preproc/pgc.l
+++ b/src/interfaces/ecpg/preproc/pgc.l
@@ -1319,7 +1319,7 @@ parse_include(void)
yyin = fopen(inc_file, "r");
if (!yyin)
{
- if (strcmp(inc_file + strlen(inc_file) - 2, ".h"))
+ if (strcmp(inc_file + strlen(inc_file) - 2, ".h") != 0)
{
strcat(inc_file, ".h");
yyin = fopen(inc_file, "r");
@@ -1346,7 +1346,7 @@ parse_include(void)
yyin = fopen(inc_file, "r");
if (!yyin)
{
- if (strcmp(inc_file + strlen(inc_file) - 2, ".h"))
+ if (strcmp(inc_file + strlen(inc_file) - 2, ".h") != 0)
{
strcat(inc_file, ".h");
yyin = fopen( inc_file, "r" );
diff --git a/src/interfaces/ecpg/preproc/type.c b/src/interfaces/ecpg/preproc/type.c
index f467a7f9c908fcf8c7389de6c6f1d797bdac2dbc..9934105c3440ce42078aee47d252c52684e43c40 100644 (file)
--- a/src/interfaces/ecpg/preproc/type.c
+++ b/src/interfaces/ecpg/preproc/type.c
@@ -257,7 +257,7 @@ ECPGdump_a_type(FILE *o, const char *name, struct ECPGtype * type, const int bra
if ((var->type->type != type->type) ||
(var->type->type_name && !type->type_name) ||
(!var->type->type_name && type->type_name) ||
- (var->type->type_name && type->type_name && strcmp(var->type->type_name, type->type_name)))
+ (var->type->type_name && type->type_name && strcmp(var->type->type_name, type->type_name) != 0))
mmerror(PARSE_ERROR, ET_ERROR, "variable \"%s\" is hidden by a local variable of a different type", name);
else if (var->brace_level != brace_level)
mmerror(PARSE_ERROR, ET_WARNING, "variable \"%s\" is hidden by a local variable", name);
@@ -271,7 +271,7 @@ ECPGdump_a_type(FILE *o, const char *name, struct ECPGtype * type, const int bra
if ((var->type->type != ind_type->type) ||
(var->type->type_name && !ind_type->type_name) ||
(!var->type->type_name && ind_type->type_name) ||
- (var->type->type_name && ind_type->type_name && strcmp(var->type->type_name, ind_type->type_name)))
+ (var->type->type_name && ind_type->type_name && strcmp(var->type->type_name, ind_type->type_name) != 0))
mmerror(PARSE_ERROR, ET_ERROR, "indicator variable \"%s\" is hidden by a local variable of a different type", ind_name);
else if (var->brace_level != ind_brace_level)
mmerror(PARSE_ERROR, ET_WARNING, "indicator variable \"%s\" is hidden by a local variable", ind_name);
diff --git a/src/interfaces/ecpg/preproc/variable.c b/src/interfaces/ecpg/preproc/variable.c
index 3ea438709abfa204afb02791e4a66e9d00cd0669..e08e14ac18ceb7f3e3b1c4930cbde82e90b38c32 100644 (file)
--- a/src/interfaces/ecpg/preproc/variable.c
+++ b/src/interfaces/ecpg/preproc/variable.c
@@ -491,7 +491,7 @@ get_typedef(char *name)
{
struct typedefs *this;
- for (this = types; this && strcmp(this->name, name); this = this->next);
+ for (this = types; this && strcmp(this->name, name) != 0; this = this->next);
if (!this)
mmerror(PARSE_ERROR, ET_FATAL, "unrecognized data type name \"%s\"", name);
diff --git a/src/interfaces/libpq/fe-lobj.c b/src/interfaces/libpq/fe-lobj.c
index 27f93e6af783aac44c827d91726be0d5231902f5..17e65de15c29630e2d68d8df00153021d49c7700 100644 (file)
--- a/src/interfaces/libpq/fe-lobj.c
+++ b/src/interfaces/libpq/fe-lobj.c
@@ -752,25 +752,25 @@ lo_initialize(PGconn *conn)
{
fname = PQgetvalue(res, n, 0);
foid = (Oid) atoi(PQgetvalue(res, n, 1));
- if (!strcmp(fname, "lo_open"))
+ if (strcmp(fname, "lo_open") == 0)
lobjfuncs->fn_lo_open = foid;
- else if (!strcmp(fname, "lo_close"))
+ else if (strcmp(fname, "lo_close") == 0)
lobjfuncs->fn_lo_close = foid;
- else if (!strcmp(fname, "lo_creat"))
+ else if (strcmp(fname, "lo_creat") == 0)
lobjfuncs->fn_lo_creat = foid;
- else if (!strcmp(fname, "lo_create"))
+ else if (strcmp(fname, "lo_create") == 0)
lobjfuncs->fn_lo_create = foid;
- else if (!strcmp(fname, "lo_unlink"))
+ else if (strcmp(fname, "lo_unlink") == 0)
lobjfuncs->fn_lo_unlink = foid;
- else if (!strcmp(fname, "lo_lseek"))
+ else if (strcmp(fname, "lo_lseek") == 0)
lobjfuncs->fn_lo_lseek = foid;
- else if (!strcmp(fname, "lo_tell"))
+ else if (strcmp(fname, "lo_tell") == 0)
lobjfuncs->fn_lo_tell = foid;
- else if (!strcmp(fname, "lo_truncate"))
+ else if (strcmp(fname, "lo_truncate") == 0)
lobjfuncs->fn_lo_truncate = foid;
- else if (!strcmp(fname, "loread"))
+ else if (strcmp(fname, "loread") == 0)
lobjfuncs->fn_lo_read = foid;
- else if (!strcmp(fname, "lowrite"))
+ else if (strcmp(fname, "lowrite") == 0)
lobjfuncs->fn_lo_write = foid;
}
This is the main PostgreSQL git repository.
RSS Atom

AltStyle によって変換されたページ (->オリジナル) /