diff options
author | Michael Paquier <michael@paquier.xyz> | 2019-04-12 10:16:49 +0900 |
---|---|---|
committer | Michael Paquier <michael@paquier.xyz> | 2019-04-12 10:16:49 +0900 |
commit | d527fda6216780281b90f48820ae978c61c7905c (patch) | |
tree | 3563030ccc2a229701963fa6f13e6e12e5a1b78e /contrib | |
parent | 798070ec058fe75757587c9e9916cc35c623f427 (diff) | |
download | postgresql-d527fda6216780281b90f48820ae978c61c7905c.tar.gz postgresql-d527fda6216780281b90f48820ae978c61c7905c.zip |
Fix more strcmp() calls using boolean-like comparisons for result checks
Such calls can confuse the reader as strcmp() uses an integer as result.
The places patched here have been spotted by Thomas Munro, David Rowley
and myself.
Author: Michael Paquier
Reviewed-by: David Rowley
Discussion: https://postgr.es/m/20190411021946.GG2728@paquier.xyz
Diffstat (limited to 'contrib')
-rw-r--r-- | contrib/spi/refint.c | 9 |
1 files changed, 6 insertions, 3 deletions
diff --git a/contrib/spi/refint.c b/contrib/spi/refint.c index f90f2bce0ea..adf0490f853 100644 --- a/contrib/spi/refint.c +++ b/contrib/spi/refint.c @@ -473,9 +473,12 @@ check_foreign_key(PG_FUNCTION_ARGS) nv = SPI_getvalue(newtuple, tupdesc, fn); type = SPI_gettype(tupdesc, fn); - if ((strcmp(type, "text") && strcmp(type, "varchar") && - strcmp(type, "char") && strcmp(type, "bpchar") && - strcmp(type, "date") && strcmp(type, "timestamp")) == 0) + if (strcmp(type, "text") == 0 || + strcmp(type, "varchar") == 0 || + strcmp(type, "char") == 0 || + strcmp(type, "bpchar") == 0 || + strcmp(type, "date") == 0 || + strcmp(type, "timestamp") == 0) is_char_type = 1; #ifdef DEBUG_QUERY elog(DEBUG4, "check_foreign_key Debug value %s type %s %d", |