1
0
mirror of https://github.com/postgres/postgres.git synced 2025-06-14 18:42:34 +03:00

Change TRUE/FALSE to true/false

The lower case spellings are C and C++ standard and are used in most
parts of the PostgreSQL sources.  The upper case spellings are only used
in some files/modules.  So standardize on the standard spellings.

The APIs for ICU, Perl, and Windows define their own TRUE and FALSE, so
those are left as is when using those APIs.

In code comments, we use the lower-case spelling for the C concepts and
keep the upper-case spelling for the SQL concepts.

Reviewed-by: Michael Paquier <michael.paquier@gmail.com>
This commit is contained in:
Peter Eisentraut
2017-08-16 00:22:32 -04:00
parent 4497f2f3b3
commit 2eb4a831e5
216 changed files with 1168 additions and 1168 deletions

View File

@ -1364,8 +1364,8 @@ gistSplit(Relation r,
IndexTupleSize(itup[0]), GiSTPageSize,
RelationGetRelationName(r))));
memset(v.spl_lisnull, TRUE, sizeof(bool) * giststate->tupdesc->natts);
memset(v.spl_risnull, TRUE, sizeof(bool) * giststate->tupdesc->natts);
memset(v.spl_lisnull, true, sizeof(bool) * giststate->tupdesc->natts);
memset(v.spl_risnull, true, sizeof(bool) * giststate->tupdesc->natts);
gistSplitByKey(r, page, itup, len, giststate, &v, 0);
/* form left and right vector */

View File

@ -197,7 +197,7 @@ gistindex_keytest(IndexScanDesc scan,
gistdentryinit(giststate, key->sk_attno - 1, &de,
datum, r, page, offset,
FALSE, isNull);
false, isNull);
/*
* Call the Consistent function to evaluate the test. The
@ -258,7 +258,7 @@ gistindex_keytest(IndexScanDesc scan,
gistdentryinit(giststate, key->sk_attno - 1, &de,
datum, r, page, offset,
FALSE, isNull);
false, isNull);
/*
* Call the Distance function to evaluate the distance. The

View File

@ -105,7 +105,7 @@ box_penalty(const BOX *original, const BOX *new)
* The GiST Consistent method for boxes
*
* Should return false if for all data items x below entry,
* the predicate x op query must be FALSE, where op is the oper
* the predicate x op query must be false, where op is the oper
* corresponding to strategy in the pg_amop table.
*/
Datum
@ -122,7 +122,7 @@ gist_box_consistent(PG_FUNCTION_ARGS)
*recheck = false;
if (DatumGetBoxP(entry->key) == NULL || query == NULL)
PG_RETURN_BOOL(FALSE);
PG_RETURN_BOOL(false);
/*
* if entry is not leaf, use rtree_internal_consistent, else use
@ -1056,7 +1056,7 @@ gist_poly_compress(PG_FUNCTION_ARGS)
retval = (GISTENTRY *) palloc(sizeof(GISTENTRY));
gistentryinit(*retval, PointerGetDatum(r),
entry->rel, entry->page,
entry->offset, FALSE);
entry->offset, false);
}
else
retval = entry;
@ -1081,7 +1081,7 @@ gist_poly_consistent(PG_FUNCTION_ARGS)
*recheck = true;
if (DatumGetBoxP(entry->key) == NULL || query == NULL)
PG_RETURN_BOOL(FALSE);
PG_RETURN_BOOL(false);
/*
* Since the operators require recheck anyway, we can just use
@ -1124,7 +1124,7 @@ gist_circle_compress(PG_FUNCTION_ARGS)
retval = (GISTENTRY *) palloc(sizeof(GISTENTRY));
gistentryinit(*retval, PointerGetDatum(r),
entry->rel, entry->page,
entry->offset, FALSE);
entry->offset, false);
}
else
retval = entry;
@ -1150,7 +1150,7 @@ gist_circle_consistent(PG_FUNCTION_ARGS)
*recheck = true;
if (DatumGetBoxP(entry->key) == NULL || query == NULL)
PG_RETURN_BOOL(FALSE);
PG_RETURN_BOOL(false);
/*
* Since the operators require recheck anyway, we can just use
@ -1186,7 +1186,7 @@ gist_point_compress(PG_FUNCTION_ARGS)
box->high = box->low = *point;
gistentryinit(*retval, BoxPGetDatum(box),
entry->rel, entry->page, entry->offset, FALSE);
entry->rel, entry->page, entry->offset, false);
PG_RETURN_POINTER(retval);
}
@ -1215,7 +1215,7 @@ gist_point_fetch(PG_FUNCTION_ARGS)
r->y = in->high.y;
gistentryinit(*retval, PointerGetDatum(r),
entry->rel, entry->page,
entry->offset, FALSE);
entry->offset, false);
PG_RETURN_POINTER(retval);
}

View File

@ -125,7 +125,7 @@ findDontCares(Relation r, GISTSTATE *giststate, GISTENTRY *valvec,
* check for nulls
*/
gistentryinit(entry, spl->splitVector.spl_rdatum, r, NULL,
(OffsetNumber) 0, FALSE);
(OffsetNumber) 0, false);
for (i = 0; i < spl->splitVector.spl_nleft; i++)
{
int j = spl->splitVector.spl_left[i];
@ -141,7 +141,7 @@ findDontCares(Relation r, GISTSTATE *giststate, GISTENTRY *valvec,
/* And conversely for the right-side tuples */
gistentryinit(entry, spl->splitVector.spl_ldatum, r, NULL,
(OffsetNumber) 0, FALSE);
(OffsetNumber) 0, false);
for (i = 0; i < spl->splitVector.spl_nright; i++)
{
int j = spl->splitVector.spl_right[i];
@ -177,7 +177,7 @@ removeDontCares(OffsetNumber *a, int *len, const bool *dontcare)
{
OffsetNumber ai = a[i];
if (dontcare[ai] == FALSE)
if (dontcare[ai] == false)
{
/* re-emit item into a[] */
*curwpos = ai;
@ -213,10 +213,10 @@ placeOne(Relation r, GISTSTATE *giststate, GistSplitVector *v,
rpenalty;
GISTENTRY entry;
gistentryinit(entry, v->spl_lattr[attno], r, NULL, 0, FALSE);
gistentryinit(entry, v->spl_lattr[attno], r, NULL, 0, false);
lpenalty = gistpenalty(giststate, attno, &entry, v->spl_lisnull[attno],
identry + attno, isnull[attno]);
gistentryinit(entry, v->spl_rattr[attno], r, NULL, 0, FALSE);
gistentryinit(entry, v->spl_rattr[attno], r, NULL, 0, false);
rpenalty = gistpenalty(giststate, attno, &entry, v->spl_risnull[attno],
identry + attno, isnull[attno]);
@ -265,10 +265,10 @@ supportSecondarySplit(Relation r, GISTSTATE *giststate, int attno,
entrySL,
entrySR;
gistentryinit(entryL, oldL, r, NULL, 0, FALSE);
gistentryinit(entryR, oldR, r, NULL, 0, FALSE);
gistentryinit(entrySL, sv->spl_ldatum, r, NULL, 0, FALSE);
gistentryinit(entrySR, sv->spl_rdatum, r, NULL, 0, FALSE);
gistentryinit(entryL, oldL, r, NULL, 0, false);
gistentryinit(entryR, oldR, r, NULL, 0, false);
gistentryinit(entrySL, sv->spl_ldatum, r, NULL, 0, false);
gistentryinit(entrySR, sv->spl_rdatum, r, NULL, 0, false);
if (sv->spl_ldatum_exists && sv->spl_rdatum_exists)
{
@ -320,8 +320,8 @@ supportSecondarySplit(Relation r, GISTSTATE *giststate, int attno,
SWAPVAR(sv->spl_left, sv->spl_right, off);
SWAPVAR(sv->spl_nleft, sv->spl_nright, noff);
SWAPVAR(sv->spl_ldatum, sv->spl_rdatum, datum);
gistentryinit(entrySL, sv->spl_ldatum, r, NULL, 0, FALSE);
gistentryinit(entrySR, sv->spl_rdatum, r, NULL, 0, FALSE);
gistentryinit(entrySL, sv->spl_ldatum, r, NULL, 0, false);
gistentryinit(entrySR, sv->spl_rdatum, r, NULL, 0, false);
}
if (sv->spl_ldatum_exists)
@ -396,20 +396,20 @@ genericPickSplit(GISTSTATE *giststate, GistEntryVector *entryvec, GIST_SPLITVEC
* Calls user picksplit method for attno column to split tuples into
* two vectors.
*
* Returns FALSE if split is complete (there are no more index columns, or
* Returns false if split is complete (there are no more index columns, or
* there is no need to consider them because split is optimal already).
*
* Returns TRUE and v->spl_dontcare = NULL if the picksplit result is
* Returns true and v->spl_dontcare = NULL if the picksplit result is
* degenerate (all tuples seem to be don't-cares), so we should just
* disregard this column and split on the next column(s) instead.
*
* Returns TRUE and v->spl_dontcare != NULL if there are don't-care tuples
* Returns true and v->spl_dontcare != NULL if there are don't-care tuples
* that could be relocated based on the next column(s). The don't-care
* tuples have been removed from the split and must be reinserted by caller.
* There is at least one non-don't-care tuple on each side of the split,
* and union keys for all columns are updated to include just those tuples.
*
* A TRUE result implies there is at least one more index column.
* A true result implies there is at least one more index column.
*/
static bool
gistUserPicksplit(Relation r, GistEntryVector *entryvec, int attno, GistSplitVector *v,
@ -610,7 +610,7 @@ gistSplitHalf(GIST_SPLITVEC *v, int len)
* attno: column we are working on (zero-based index)
*
* Outside caller must initialize v->spl_lisnull and v->spl_risnull arrays
* to all-TRUE. On return, spl_left/spl_nleft contain indexes of tuples
* to all-true. On return, spl_left/spl_nleft contain indexes of tuples
* to go left, spl_right/spl_nright contain indexes of tuples to go right,
* spl_lattr/spl_lisnull contain left-side union key values, and
* spl_rattr/spl_risnull contain right-side union key values. Other fields
@ -643,7 +643,7 @@ gistSplitByKey(Relation r, Page page, IndexTuple *itup, int len,
&IsNull);
gistdentryinit(giststate, attno, &(entryvec->vector[i]),
datum, r, page, i,
FALSE, IsNull);
false, IsNull);
if (IsNull)
offNullTuples[nOffNullTuples++] = i;
}
@ -655,7 +655,7 @@ gistSplitByKey(Relation r, Page page, IndexTuple *itup, int len,
* our attention to the next column. If there's no next column, just
* split page in half.
*/
v->spl_risnull[attno] = v->spl_lisnull[attno] = TRUE;
v->spl_risnull[attno] = v->spl_lisnull[attno] = true;
if (attno + 1 < giststate->tupdesc->natts)
gistSplitByKey(r, page, itup, len, giststate, v, attno + 1);
@ -672,7 +672,7 @@ gistSplitByKey(Relation r, Page page, IndexTuple *itup, int len,
*/
v->splitVector.spl_right = offNullTuples;
v->splitVector.spl_nright = nOffNullTuples;
v->spl_risnull[attno] = TRUE;
v->spl_risnull[attno] = true;
v->splitVector.spl_left = (OffsetNumber *) palloc(len * sizeof(OffsetNumber));
v->splitVector.spl_nleft = 0;

View File

@ -179,7 +179,7 @@ gistMakeUnionItVec(GISTSTATE *giststate, IndexTuple *itvec, int len,
evec->vector + evec->n,
datum,
NULL, NULL, (OffsetNumber) 0,
FALSE, IsNull);
false, IsNull);
evec->n++;
}
@ -187,7 +187,7 @@ gistMakeUnionItVec(GISTSTATE *giststate, IndexTuple *itvec, int len,
if (evec->n == 0)
{
attr[i] = (Datum) 0;
isnull[i] = TRUE;
isnull[i] = true;
}
else
{
@ -204,7 +204,7 @@ gistMakeUnionItVec(GISTSTATE *giststate, IndexTuple *itvec, int len,
PointerGetDatum(evec),
PointerGetDatum(&attrsize));
isnull[i] = FALSE;
isnull[i] = false;
}
}
}
@ -246,17 +246,17 @@ gistMakeUnionKey(GISTSTATE *giststate, int attno,
if (isnull1 && isnull2)
{
*dstisnull = TRUE;
*dstisnull = true;
*dst = (Datum) 0;
}
else
{
if (isnull1 == FALSE && isnull2 == FALSE)
if (isnull1 == false && isnull2 == false)
{
evec->vector[0] = *entry1;
evec->vector[1] = *entry2;
}
else if (isnull1 == FALSE)
else if (isnull1 == false)
{
evec->vector[0] = *entry1;
evec->vector[1] = *entry1;
@ -267,7 +267,7 @@ gistMakeUnionKey(GISTSTATE *giststate, int attno,
evec->vector[1] = *entry2;
}
*dstisnull = FALSE;
*dstisnull = false;
*dst = FunctionCall2Coll(&giststate->unionFn[attno],
giststate->supportCollation[attno],
PointerGetDatum(evec),
@ -303,7 +303,7 @@ gistDeCompressAtt(GISTSTATE *giststate, Relation r, IndexTuple tuple, Page p,
datum = index_getattr(tuple, i + 1, giststate->tupdesc, &isnull[i]);
gistdentryinit(giststate, i, &attdata[i],
datum, r, p, o,
FALSE, isnull[i]);
false, isnull[i]);
}
}
@ -313,7 +313,7 @@ gistDeCompressAtt(GISTSTATE *giststate, Relation r, IndexTuple tuple, Page p,
IndexTuple
gistgetadjusted(Relation r, IndexTuple oldtup, IndexTuple addtup, GISTSTATE *giststate)
{
bool neednew = FALSE;
bool neednew = false;
GISTENTRY oldentries[INDEX_MAX_KEYS],
addentries[INDEX_MAX_KEYS];
bool oldisnull[INDEX_MAX_KEYS],
@ -451,7 +451,7 @@ gistchoose(Relation r, Page p, IndexTuple it, /* it has compressed entry */
/* Compute penalty for this column. */
datum = index_getattr(itup, j + 1, giststate->tupdesc, &IsNull);
gistdentryinit(giststate, j, &entry, datum, r, p, i,
FALSE, IsNull);
false, IsNull);
usize = gistpenalty(giststate, j, &entry, IsNull,
&identry[j], isnull[j]);
if (usize > 0)
@ -691,8 +691,8 @@ gistpenalty(GISTSTATE *giststate, int attno,
{
float penalty = 0.0;
if (giststate->penaltyFn[attno].fn_strict == FALSE ||
(isNullOrig == FALSE && isNullAdd == FALSE))
if (giststate->penaltyFn[attno].fn_strict == false ||
(isNullOrig == false && isNullAdd == false))
{
FunctionCall3Coll(&giststate->penaltyFn[attno],
giststate->supportCollation[attno],