1
0
mirror of https://github.com/postgres/postgres.git synced 2025-07-30 11:03:19 +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

@ -41,7 +41,7 @@ ginTraverseLock(Buffer buffer, bool searchMode)
page = BufferGetPage(buffer);
if (GinPageIsLeaf(page))
{
if (searchMode == FALSE)
if (searchMode == false)
{
/* we should relock our page */
LockBuffer(buffer, GIN_UNLOCK);
@ -107,7 +107,7 @@ ginFindLeafPage(GinBtree btree, bool searchMode, Snapshot snapshot)
* ok, page is correctly locked, we should check to move right ..,
* root never has a right link, so small optimization
*/
while (btree->fullScan == FALSE && stack->blkno != btree->rootBlkno &&
while (btree->fullScan == false && stack->blkno != btree->rootBlkno &&
btree->isMoveRight(btree, page))
{
BlockNumber rightlink = GinPageGetOpaque(page)->rightlink;

View File

@ -52,7 +52,7 @@ ginCombineData(RBNode *existing, const RBNode *newdata, void *arg)
}
/* If item pointers are not ordered, they will need to be sorted later */
if (eo->shouldSort == FALSE)
if (eo->shouldSort == false)
{
int res;
@ -60,7 +60,7 @@ ginCombineData(RBNode *existing, const RBNode *newdata, void *arg)
Assert(res != 0);
if (res > 0)
eo->shouldSort = TRUE;
eo->shouldSort = true;
}
eo->list[eo->count] = en->list[0];
@ -176,7 +176,7 @@ ginInsertBAEntry(BuildAccumulator *accum,
ea->key = getDatumCopy(accum, attnum, key);
ea->maxcount = DEF_NPTR;
ea->count = 1;
ea->shouldSort = FALSE;
ea->shouldSort = false;
ea->list =
(ItemPointerData *) palloc(sizeof(ItemPointerData) * DEF_NPTR);
ea->list[0] = *heapptr;

View File

@ -235,9 +235,9 @@ dataIsMoveRight(GinBtree btree, Page page)
ItemPointer iptr = GinDataPageGetRightBound(page);
if (GinPageRightMost(page))
return FALSE;
return false;
return (ginCompareItemPointers(&btree->itemptr, iptr) > 0) ? TRUE : FALSE;
return (ginCompareItemPointers(&btree->itemptr, iptr) > 0) ? true : false;
}
/*
@ -1875,9 +1875,9 @@ ginPrepareDataScan(GinBtree btree, Relation index, BlockNumber rootBlkno)
btree->fillRoot = ginDataFillRoot;
btree->prepareDownlink = dataPrepareDownlink;
btree->isData = TRUE;
btree->fullScan = FALSE;
btree->isBuild = FALSE;
btree->isData = true;
btree->fullScan = false;
btree->isBuild = false;
}
/*
@ -1919,9 +1919,9 @@ ginScanBeginPostingTree(GinBtree btree, Relation index, BlockNumber rootBlkno,
ginPrepareDataScan(btree, index, rootBlkno);
btree->fullScan = TRUE;
btree->fullScan = true;
stack = ginFindLeafPage(btree, TRUE, snapshot);
stack = ginFindLeafPage(btree, true, snapshot);
return stack;
}

View File

@ -30,7 +30,7 @@ static void entrySplitPage(GinBtree btree, Buffer origbuf,
* Form a tuple for entry tree.
*
* If the tuple would be too big to be stored, function throws a suitable
* error if errorTooBig is TRUE, or returns NULL if errorTooBig is FALSE.
* error if errorTooBig is true, or returns NULL if errorTooBig is false.
*
* See src/backend/access/gin/README for a description of the index tuple
* format that is being built here. We build on the assumption that we
@ -249,7 +249,7 @@ entryIsMoveRight(GinBtree btree, Page page)
GinNullCategory category;
if (GinPageRightMost(page))
return FALSE;
return false;
itup = getRightMostTuple(page);
attnum = gintuple_get_attrnum(btree->ginstate, itup);
@ -258,9 +258,9 @@ entryIsMoveRight(GinBtree btree, Page page)
if (ginCompareAttEntries(btree->ginstate,
btree->entryAttnum, btree->entryKey, btree->entryCategory,
attnum, key, category) > 0)
return TRUE;
return true;
return FALSE;
return false;
}
/*
@ -356,7 +356,7 @@ entryLocateLeafEntry(GinBtree btree, GinBtreeStack *stack)
if (btree->fullScan)
{
stack->off = FirstOffsetNumber;
return TRUE;
return true;
}
low = FirstOffsetNumber;
@ -762,9 +762,9 @@ ginPrepareEntryScan(GinBtree btree, OffsetNumber attnum,
btree->fillRoot = ginEntryFillRoot;
btree->prepareDownlink = entryPrepareDownlink;
btree->isData = FALSE;
btree->fullScan = FALSE;
btree->isBuild = FALSE;
btree->isData = false;
btree->fullScan = false;
btree->isBuild = false;
btree->entryAttnum = attnum;
btree->entryKey = key;

View File

@ -311,7 +311,7 @@ restartScanEntry:
entry->nlist = 0;
entry->matchBitmap = NULL;
entry->matchResult = NULL;
entry->reduceResult = FALSE;
entry->reduceResult = false;
entry->predictNumberResult = 0;
/*
@ -324,9 +324,9 @@ restartScanEntry:
stackEntry = ginFindLeafPage(&btreeEntry, true, snapshot);
page = BufferGetPage(stackEntry->buffer);
/* ginFindLeafPage() will have already checked snapshot age. */
needUnlock = TRUE;
needUnlock = true;
entry->isFinished = TRUE;
entry->isFinished = true;
if (entry->isPartialMatch ||
entry->queryCategory == GIN_CAT_EMPTY_QUERY)
@ -363,7 +363,7 @@ restartScanEntry:
if (entry->matchBitmap && !tbm_is_empty(entry->matchBitmap))
{
entry->matchIterator = tbm_begin_iterate(entry->matchBitmap);
entry->isFinished = FALSE;
entry->isFinished = false;
}
}
else if (btreeEntry.findItem(&btreeEntry, stackEntry))
@ -385,7 +385,7 @@ restartScanEntry:
* root of posting tree.
*/
LockBuffer(stackEntry->buffer, GIN_UNLOCK);
needUnlock = FALSE;
needUnlock = false;
stack = ginScanBeginPostingTree(&entry->btree, ginstate->index,
rootPostingTree, snapshot);
@ -410,7 +410,7 @@ restartScanEntry:
LockBuffer(entry->buffer, GIN_UNLOCK);
freeGinBtreeStack(stack);
entry->isFinished = FALSE;
entry->isFinished = false;
}
else if (GinGetNPosting(itup) > 0)
{
@ -418,7 +418,7 @@ restartScanEntry:
&entry->nlist);
entry->predictNumberResult = entry->nlist;
entry->isFinished = FALSE;
entry->isFinished = false;
}
}
@ -565,7 +565,7 @@ startScan(IndexScanDesc scan)
for (i = 0; i < so->totalentries; i++)
{
so->entries[i]->predictNumberResult /= so->totalentries;
so->entries[i]->reduceResult = TRUE;
so->entries[i]->reduceResult = true;
}
}
}
@ -666,7 +666,7 @@ entryLoadMoreItems(GinState *ginstate, GinScanEntry entry,
{
UnlockReleaseBuffer(entry->buffer);
entry->buffer = InvalidBuffer;
entry->isFinished = TRUE;
entry->isFinished = true;
return;
}
@ -728,7 +728,7 @@ entryLoadMoreItems(GinState *ginstate, GinScanEntry entry,
/*
* Sets entry->curItem to next heap item pointer > advancePast, for one entry
* of one scan key, or sets entry->isFinished to TRUE if there are no more.
* of one scan key, or sets entry->isFinished to true if there are no more.
*
* Item pointers are returned in ascending order.
*
@ -775,7 +775,7 @@ entryGetItem(GinState *ginstate, GinScanEntry entry,
ItemPointerSetInvalid(&entry->curItem);
tbm_end_iterate(entry->matchIterator);
entry->matchIterator = NULL;
entry->isFinished = TRUE;
entry->isFinished = true;
break;
}
@ -835,7 +835,7 @@ entryGetItem(GinState *ginstate, GinScanEntry entry,
entry->matchResult->offsets[entry->offset]);
entry->offset++;
gotitem = true;
} while (!gotitem || (entry->reduceResult == TRUE && dropItem(entry)));
} while (!gotitem || (entry->reduceResult == true && dropItem(entry)));
}
else if (!BufferIsValid(entry->buffer))
{
@ -848,7 +848,7 @@ entryGetItem(GinState *ginstate, GinScanEntry entry,
if (entry->offset >= entry->nlist)
{
ItemPointerSetInvalid(&entry->curItem);
entry->isFinished = TRUE;
entry->isFinished = true;
break;
}
@ -876,7 +876,7 @@ entryGetItem(GinState *ginstate, GinScanEntry entry,
entry->curItem = entry->list[entry->offset++];
} while (ginCompareItemPointers(&entry->curItem, &advancePast) <= 0 ||
(entry->reduceResult == TRUE && dropItem(entry)));
(entry->reduceResult == true && dropItem(entry)));
}
}
@ -891,7 +891,7 @@ entryGetItem(GinState *ginstate, GinScanEntry entry,
* iff recheck is needed for this item pointer (including the case where the
* item pointer is a lossy page pointer).
*
* If all entry streams are exhausted, sets key->isFinished to TRUE.
* If all entry streams are exhausted, sets key->isFinished to true.
*
* Item pointers must be returned in ascending order.
*
@ -963,7 +963,7 @@ keyGetItem(GinState *ginstate, MemoryContext tempCtx, GinScanKey key,
if (allFinished)
{
/* all entries are finished */
key->isFinished = TRUE;
key->isFinished = true;
return;
}
@ -1051,7 +1051,7 @@ keyGetItem(GinState *ginstate, MemoryContext tempCtx, GinScanKey key,
* them. We could pass them as MAYBE as well, but if we're using the
* "shim" implementation of a tri-state consistent function (see
* ginlogic.c), it's better to pass as few MAYBEs as possible. So pass
* them as TRUE.
* them as true.
*
* Note that only lossy-page entries pointing to the current item's page
* should trigger this processing; we might have future lossy pages in the
@ -1064,7 +1064,7 @@ keyGetItem(GinState *ginstate, MemoryContext tempCtx, GinScanKey key,
for (i = 0; i < key->nentries; i++)
{
entry = key->scanEntry[i];
if (entry->isFinished == FALSE &&
if (entry->isFinished == false &&
ginCompareItemPointers(&entry->curItem, &curPageLossy) == 0)
{
if (i < key->nuserentries)
@ -1314,7 +1314,7 @@ scanGetItem(IndexScanDesc scan, ItemPointerData advancePast,
}
}
return TRUE;
return true;
}
@ -1508,7 +1508,7 @@ collectMatchesForHeapRow(IndexScanDesc scan, pendingPosition *pos)
memset(key->entryRes, GIN_FALSE, key->nentries);
}
memset(pos->hasMatchKey, FALSE, so->nkeys);
memset(pos->hasMatchKey, false, so->nkeys);
/*
* Outer loop iterates over multiple pending-list pages when a single heap

View File

@ -185,7 +185,7 @@ ginEntryInsert(GinState *ginstate,
IndexTuple itup;
Page page;
insertdata.isDelete = FALSE;
insertdata.isDelete = false;
/* During index build, count the to-be-inserted entry */
if (buildStats)
@ -221,7 +221,7 @@ ginEntryInsert(GinState *ginstate,
itup = addItemPointersToLeafTuple(ginstate, itup,
items, nitem, buildStats);
insertdata.isDelete = TRUE;
insertdata.isDelete = true;
}
else
{

View File

@ -235,7 +235,7 @@ ginScanToDelete(GinVacuumState *gvs, BlockNumber blkno, bool isRoot,
DataPageDeleteStack *me;
Buffer buffer;
Page page;
bool meDelete = FALSE;
bool meDelete = false;
bool isempty;
if (isRoot)
@ -274,7 +274,7 @@ ginScanToDelete(GinVacuumState *gvs, BlockNumber blkno, bool isRoot,
{
PostingItem *pitem = GinDataPageGetPostingItem(page, i);
if (ginScanToDelete(gvs, PostingItemGetBlockNumber(pitem), FALSE, me, i))
if (ginScanToDelete(gvs, PostingItemGetBlockNumber(pitem), false, me, i))
i--;
}
}
@ -291,7 +291,7 @@ ginScanToDelete(GinVacuumState *gvs, BlockNumber blkno, bool isRoot,
{
Assert(!isRoot);
ginDeletePage(gvs, blkno, me->leftBlkno, me->parent->blkno, myoff, me->parent->isRoot);
meDelete = TRUE;
meDelete = true;
}
}
@ -319,7 +319,7 @@ ginVacuumPostingTreeLeaves(GinVacuumState *gvs, BlockNumber blkno, bool isRoot)
{
Buffer buffer;
Page page;
bool hasVoidPage = FALSE;
bool hasVoidPage = false;
MemoryContext oldCxt;
buffer = ReadBufferExtended(gvs->index, MAIN_FORKNUM, blkno,
@ -339,7 +339,7 @@ ginVacuumPostingTreeLeaves(GinVacuumState *gvs, BlockNumber blkno, bool isRoot)
/* if root is a leaf page, we don't desire further processing */
if (GinDataLeafPageIsEmpty(page))
hasVoidPage = TRUE;
hasVoidPage = true;
UnlockReleaseBuffer(buffer);
@ -348,8 +348,8 @@ ginVacuumPostingTreeLeaves(GinVacuumState *gvs, BlockNumber blkno, bool isRoot)
else
{
OffsetNumber i;
bool hasEmptyChild = FALSE;
bool hasNonEmptyChild = FALSE;
bool hasEmptyChild = false;
bool hasNonEmptyChild = false;
OffsetNumber maxoff = GinPageGetOpaque(page)->maxoff;
BlockNumber *children = palloc(sizeof(BlockNumber) * (maxoff + 1));
@ -369,10 +369,10 @@ ginVacuumPostingTreeLeaves(GinVacuumState *gvs, BlockNumber blkno, bool isRoot)
for (i = FirstOffsetNumber; i <= maxoff; i++)
{
if (ginVacuumPostingTreeLeaves(gvs, children[i], FALSE))
hasEmptyChild = TRUE;
if (ginVacuumPostingTreeLeaves(gvs, children[i], false))
hasEmptyChild = true;
else
hasNonEmptyChild = TRUE;
hasNonEmptyChild = true;
}
pfree(children);
@ -380,12 +380,12 @@ ginVacuumPostingTreeLeaves(GinVacuumState *gvs, BlockNumber blkno, bool isRoot)
vacuum_delay_point();
/*
* All subtree is empty - just return TRUE to indicate that parent
* All subtree is empty - just return true to indicate that parent
* must do a cleanup. Unless we are ROOT an there is way to go upper.
*/
if (hasEmptyChild && !hasNonEmptyChild && !isRoot)
return TRUE;
return true;
if (hasEmptyChild)
{
@ -399,9 +399,9 @@ ginVacuumPostingTreeLeaves(GinVacuumState *gvs, BlockNumber blkno, bool isRoot)
memset(&root, 0, sizeof(DataPageDeleteStack));
root.leftBlkno = InvalidBlockNumber;
root.isRoot = TRUE;
root.isRoot = true;
ginScanToDelete(gvs, blkno, TRUE, &root, InvalidOffsetNumber);
ginScanToDelete(gvs, blkno, true, &root, InvalidOffsetNumber);
ptr = root.child;
@ -416,14 +416,14 @@ ginVacuumPostingTreeLeaves(GinVacuumState *gvs, BlockNumber blkno, bool isRoot)
}
/* Here we have deleted all empty subtrees */
return FALSE;
return false;
}
}
static void
ginVacuumPostingTree(GinVacuumState *gvs, BlockNumber rootBlkno)
{
ginVacuumPostingTreeLeaves(gvs, rootBlkno, TRUE);
ginVacuumPostingTreeLeaves(gvs, rootBlkno, true);
}
/*