mirror of
https://git.postgresql.org/git/postgresql.git
synced 2025-01-18 18:44:06 +08:00
Convert PageAddItem into a macro to save a few cycles.
Nowadays this is just a backwards-compatibility wrapper around PageAddItemExtended, so let's avoid the extra level of function call. In addition, because pretty much all callers are passing constants for the two bool arguments, compilers will be able to constant-fold the conversion to a flags bitmask. Discussion: <552.1473445163@sss.pgh.pa.us>
This commit is contained in:
parent
b1328d78f8
commit
1a4be103a5
@ -338,26 +338,6 @@ PageAddItemExtended(Page page,
|
||||
return offsetNumber;
|
||||
}
|
||||
|
||||
/*
|
||||
* PageAddItem
|
||||
*
|
||||
* Add an item to a page. Return value is offset at which it was
|
||||
* inserted, or InvalidOffsetNumber if the item is not inserted for
|
||||
* any reason.
|
||||
*
|
||||
* Passing the 'overwrite' and 'is_heap' parameters as true causes the
|
||||
* PAI_OVERWRITE and PAI_IS_HEAP flags to be set, respectively.
|
||||
*
|
||||
* !!! EREPORT(ERROR) IS DISALLOWED HERE !!!
|
||||
*/
|
||||
OffsetNumber
|
||||
PageAddItem(Page page, Item item, Size size, OffsetNumber offsetNumber,
|
||||
bool overwrite, bool is_heap)
|
||||
{
|
||||
return PageAddItemExtended(page, item, size, offsetNumber,
|
||||
overwrite ? PAI_OVERWRITE : 0 |
|
||||
is_heap ? PAI_IS_HEAP : 0);
|
||||
}
|
||||
|
||||
/*
|
||||
* PageGetTempPage
|
||||
|
@ -410,10 +410,13 @@ do { \
|
||||
#define PAI_OVERWRITE (1 << 0)
|
||||
#define PAI_IS_HEAP (1 << 1)
|
||||
|
||||
#define PageAddItem(page, item, size, offsetNumber, overwrite, is_heap) \
|
||||
PageAddItemExtended(page, item, size, offsetNumber, \
|
||||
((overwrite) ? PAI_OVERWRITE : 0) | \
|
||||
((is_heap) ? PAI_IS_HEAP : 0))
|
||||
|
||||
extern void PageInit(Page page, Size pageSize, Size specialSize);
|
||||
extern bool PageIsVerified(Page page, BlockNumber blkno);
|
||||
extern OffsetNumber PageAddItem(Page page, Item item, Size size,
|
||||
OffsetNumber offsetNumber, bool overwrite, bool is_heap);
|
||||
extern OffsetNumber PageAddItemExtended(Page page, Item item, Size size,
|
||||
OffsetNumber offsetNumber, int flags);
|
||||
extern Page PageGetTempPage(Page page);
|
||||
|
Loading…
Reference in New Issue
Block a user