aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorMichael Paquier <michael@paquier.xyz>2021-10-11 09:36:42 +0900
committerMichael Paquier <michael@paquier.xyz>2021-10-11 09:36:42 +0900
commit68f7c4b57a27dbcd3e93ba3ff7b0b49664b25e09 (patch)
tree444cc4fc9daae20d15c706655f89154a7a359367 /src
parent3eb1f4d09745433c70ccac411cad24d0374b9c3b (diff)
downloadpostgresql-68f7c4b57a27dbcd3e93ba3ff7b0b49664b25e09.tar.gz
postgresql-68f7c4b57a27dbcd3e93ba3ff7b0b49664b25e09.zip
Clean up more code using "(expr) ? true : false"
This is similar to fd0625c, taking care of any remaining code paths that are worth the cleanup. This also changes some cases using opposite expression patterns. Author: Justin Pryzby, Masahiko Sawada Discussion: https://postgr.es/m/CAD21AoCdF8dnUvr-BUWWGvA_XhKSoANacBMZb6jKyCk4TYfQ2Q@mail.gmail.com
Diffstat (limited to 'src')
-rw-r--r--src/backend/access/gist/gistsplit.c8
-rw-r--r--src/backend/commands/tablecmds.c2
-rw-r--r--src/backend/executor/nodeResult.c4
-rw-r--r--src/backend/statistics/mcv.c3
-rw-r--r--src/backend/tsearch/ts_utils.c2
-rw-r--r--src/backend/tsearch/wparser_def.c2
6 files changed, 10 insertions, 11 deletions
diff --git a/src/backend/access/gist/gistsplit.c b/src/backend/access/gist/gistsplit.c
index 853ebc387b4..1c5d4e9ca22 100644
--- a/src/backend/access/gist/gistsplit.c
+++ b/src/backend/access/gist/gistsplit.c
@@ -421,8 +421,8 @@ gistUserPicksplit(Relation r, GistEntryVector *entryvec, int attno, GistSplitVec
* Prepare spl_ldatum/spl_rdatum/spl_ldatum_exists/spl_rdatum_exists in
* case we are doing a secondary split (see comments in gist.h).
*/
- sv->spl_ldatum_exists = (v->spl_lisnull[attno]) ? false : true;
- sv->spl_rdatum_exists = (v->spl_risnull[attno]) ? false : true;
+ sv->spl_ldatum_exists = !(v->spl_lisnull[attno]);
+ sv->spl_rdatum_exists = !(v->spl_risnull[attno]);
sv->spl_ldatum = v->spl_lattr[attno];
sv->spl_rdatum = v->spl_rattr[attno];
@@ -451,8 +451,8 @@ gistUserPicksplit(Relation r, GistEntryVector *entryvec, int attno, GistSplitVec
* Reinit GIST_SPLITVEC. Although these fields are not used by
* genericPickSplit(), set them up for further processing
*/
- sv->spl_ldatum_exists = (v->spl_lisnull[attno]) ? false : true;
- sv->spl_rdatum_exists = (v->spl_risnull[attno]) ? false : true;
+ sv->spl_ldatum_exists = !(v->spl_lisnull[attno]);
+ sv->spl_rdatum_exists = !(v->spl_risnull[attno]);
sv->spl_ldatum = v->spl_lattr[attno];
sv->spl_rdatum = v->spl_rattr[attno];
diff --git a/src/backend/commands/tablecmds.c b/src/backend/commands/tablecmds.c
index ff97b618e63..1c2ebe1bf69 100644
--- a/src/backend/commands/tablecmds.c
+++ b/src/backend/commands/tablecmds.c
@@ -7463,7 +7463,7 @@ ATExecColumnDefault(Relation rel, const char *colName,
* operation when the user asked for a drop.
*/
RemoveAttrDefault(RelationGetRelid(rel), attnum, DROP_RESTRICT, false,
- newDefault == NULL ? false : true);
+ newDefault != NULL);
if (newDefault)
{
diff --git a/src/backend/executor/nodeResult.c b/src/backend/executor/nodeResult.c
index 0946af0a549..a8d308c6602 100644
--- a/src/backend/executor/nodeResult.c
+++ b/src/backend/executor/nodeResult.c
@@ -195,7 +195,7 @@ ExecInitResult(Result *node, EState *estate, int eflags)
resstate->ps.ExecProcNode = ExecResult;
resstate->rs_done = false;
- resstate->rs_checkqual = (node->resconstantqual == NULL) ? false : true;
+ resstate->rs_checkqual = (node->resconstantqual != NULL);
/*
* Miscellaneous initialization
@@ -260,7 +260,7 @@ void
ExecReScanResult(ResultState *node)
{
node->rs_done = false;
- node->rs_checkqual = (node->resconstantqual == NULL) ? false : true;
+ node->rs_checkqual = (node->resconstantqual != NULL);
/*
* If chgParam of subnode is not null then plan will be re-scanned by
diff --git a/src/backend/statistics/mcv.c b/src/backend/statistics/mcv.c
index 35b39ece075..b350fc5f7b2 100644
--- a/src/backend/statistics/mcv.c
+++ b/src/backend/statistics/mcv.c
@@ -1619,8 +1619,7 @@ mcv_get_match_bitmap(PlannerInfo *root, List *clauses,
Assert(mcvlist->nitems <= STATS_MCVLIST_MAX_ITEMS);
matches = palloc(sizeof(bool) * mcvlist->nitems);
- memset(matches, (is_or) ? false : true,
- sizeof(bool) * mcvlist->nitems);
+ memset(matches, !is_or, sizeof(bool) * mcvlist->nitems);
/*
* Loop through the list of clauses, and for each of them evaluate all the
diff --git a/src/backend/tsearch/ts_utils.c b/src/backend/tsearch/ts_utils.c
index ed16a2e25a2..9539cf1326b 100644
--- a/src/backend/tsearch/ts_utils.c
+++ b/src/backend/tsearch/ts_utils.c
@@ -142,5 +142,5 @@ searchstoplist(StopList *s, char *key)
{
return (s->stop && s->len > 0 &&
bsearch(&key, s->stop, s->len,
- sizeof(char *), pg_qsort_strcmp)) ? true : false;
+ sizeof(char *), pg_qsort_strcmp));
}
diff --git a/src/backend/tsearch/wparser_def.c b/src/backend/tsearch/wparser_def.c
index 559dff63558..537c701cc7f 100644
--- a/src/backend/tsearch/wparser_def.c
+++ b/src/backend/tsearch/wparser_def.c
@@ -1856,7 +1856,7 @@ TParserGet(TParser *prs)
}
}
- return (item && (item->flags & A_BINGO)) ? true : false;
+ return (item && (item->flags & A_BINGO));
}
Datum