mirror of
https://github.com/postgres/postgres.git
synced 2025-07-28 23:42:10 +03:00
Minor code-cleanliness improvements for btree.
Make the btree page-flags test macros (P_ISLEAF and friends) return clean boolean values, rather than values that might not fit in a bool. Use them in a few places that were randomly referencing the flag bits directly. In passing, change access/nbtree/'s only direct use of BUFFER_LOCK_SHARE to BT_READ. (Some think we should go the other way, but as long as we have BT_READ/BT_WRITE, let's use them consistently.) Masahiko Sawada, reviewed by Doug Doole Discussion: https://postgr.es/m/CAD21AoBmWPeN=WBB5Jvyz_Nt3rmW1ebUyAnk3ZbJP3RMXALJog@mail.gmail.com
This commit is contained in:
@ -1195,7 +1195,7 @@ palloc_btree_page(BtreeCheckState *state, BlockNumber blocknum)
|
||||
|
||||
opaque = (BTPageOpaque) PageGetSpecialPointer(page);
|
||||
|
||||
if (opaque->btpo_flags & BTP_META && blocknum != BTREE_METAPAGE)
|
||||
if (P_ISMETA(opaque) && blocknum != BTREE_METAPAGE)
|
||||
ereport(ERROR,
|
||||
(errcode(ERRCODE_INDEX_CORRUPTED),
|
||||
errmsg("invalid meta page found at block %u in index \"%s\"",
|
||||
@ -1206,7 +1206,7 @@ palloc_btree_page(BtreeCheckState *state, BlockNumber blocknum)
|
||||
{
|
||||
BTMetaPageData *metad = BTPageGetMeta(page);
|
||||
|
||||
if (!(opaque->btpo_flags & BTP_META) ||
|
||||
if (!P_ISMETA(opaque) ||
|
||||
metad->btm_magic != BTREE_MAGIC)
|
||||
ereport(ERROR,
|
||||
(errcode(ERRCODE_INDEX_CORRUPTED),
|
||||
|
Reference in New Issue
Block a user