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
ltree_lt(PG_FUNCTION_ARGS)
{
RUNCMP;
- PG_RETURN_BOOL((res < 0) ? true : false);
+ PG_RETURN_BOOL(res < 0);
}
Datum
ltree_le(PG_FUNCTION_ARGS)
{
RUNCMP;
- PG_RETURN_BOOL((res <= 0) ? true : false);
+ PG_RETURN_BOOL(res <= 0);
}
Datum
ltree_eq(PG_FUNCTION_ARGS)
{
RUNCMP;
- PG_RETURN_BOOL((res == 0) ? true : false);
+ PG_RETURN_BOOL(res == 0);
}
Datum
ltree_ge(PG_FUNCTION_ARGS)
{
RUNCMP;
- PG_RETURN_BOOL((res >= 0) ? true : false);
+ PG_RETURN_BOOL(res >= 0);
}
Datum
ltree_gt(PG_FUNCTION_ARGS)
{
RUNCMP;
- PG_RETURN_BOOL((res > 0) ? true : false);
+ PG_RETURN_BOOL(res > 0);
}
Datum
ltree_ne(PG_FUNCTION_ARGS)
{
RUNCMP;
- PG_RETURN_BOOL((res != 0) ? true : false);
+ PG_RETURN_BOOL(res != 0);
}
Datum
* 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];
* 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];
* operation when the user asked for a drop.
*/
RemoveAttrDefault(RelationGetRelid(rel), attnum, DROP_RESTRICT, false,
- newDefault == NULL ? false : true);
+ newDefault != NULL);
if (newDefault)
{
resstate->ps.ExecProcNode = ExecResult;
resstate->rs_done = false;
- resstate->rs_checkqual = (node->resconstantqual == NULL) ? false : true;
+ resstate->rs_checkqual = (node->resconstantqual != NULL);
/*
* Miscellaneous initialization
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
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
{
return (s->stop && s->len > 0 &&
bsearch(&key, s->stop, s->len,
- sizeof(char *), pg_qsort_strcmp)) ? true : false;
+ sizeof(char *), pg_qsort_strcmp));
}
}
}
- return (item && (item->flags & A_BINGO)) ? true : false;
+ return (item && (item->flags & A_BINGO));
}
Datum