1
0
mirror of https://github.com/postgres/postgres.git synced 2025-07-03 20:02:46 +03:00

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
This commit is contained in:
Michael Paquier
2019-04-12 10:16:49 +09:00
parent 798070ec05
commit d527fda621
4 changed files with 16 additions and 12 deletions

View File

@ -75,8 +75,8 @@ test_rls_hooks_permissive(CmdType cmdtype, Relation relation)
ParseState *qual_pstate;
RangeTblEntry *rte;
if (strcmp(RelationGetRelationName(relation), "rls_test_permissive")
&& strcmp(RelationGetRelationName(relation), "rls_test_both"))
if (strcmp(RelationGetRelationName(relation), "rls_test_permissive") != 0 &&
strcmp(RelationGetRelationName(relation), "rls_test_both") != 0)
return NIL;
qual_pstate = make_parsestate(NULL);
@ -140,8 +140,8 @@ test_rls_hooks_restrictive(CmdType cmdtype, Relation relation)
RangeTblEntry *rte;
if (strcmp(RelationGetRelationName(relation), "rls_test_restrictive")
&& strcmp(RelationGetRelationName(relation), "rls_test_both"))
if (strcmp(RelationGetRelationName(relation), "rls_test_restrictive") != 0 &&
strcmp(RelationGetRelationName(relation), "rls_test_both") != 0)
return NIL;
qual_pstate = make_parsestate(NULL);