summaryrefslogtreecommitdiff
path: root/src/include/access/nbtree.h
diff options
context:
space:
mode:
authorTom Lane <tgl@sss.pgh.pa.us>2017-09-18 16:36:28 -0400
committerTom Lane <tgl@sss.pgh.pa.us>2017-09-18 16:36:28 -0400
commiteb5c404b17752ca566947f12cb702438dcccdcb1 (patch)
treea81c6221cc1376d3b911d2b20e9e86e5d737a189 /src/include/access/nbtree.h
parent66917bfaa7bb0b6bae52a5fe631a8b6443203f55 (diff)
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
Diffstat (limited to 'src/include/access/nbtree.h')
-rw-r--r--src/include/access/nbtree.h16
1 files changed, 8 insertions, 8 deletions
diff --git a/src/include/access/nbtree.h b/src/include/access/nbtree.h
index e6abbec280d..2d4c36d0b89 100644
--- a/src/include/access/nbtree.h
+++ b/src/include/access/nbtree.h
@@ -173,14 +173,14 @@ typedef struct BTMetaPageData
*/
#define P_LEFTMOST(opaque) ((opaque)->btpo_prev == P_NONE)
#define P_RIGHTMOST(opaque) ((opaque)->btpo_next == P_NONE)
-#define P_ISLEAF(opaque) ((opaque)->btpo_flags & BTP_LEAF)
-#define P_ISROOT(opaque) ((opaque)->btpo_flags & BTP_ROOT)
-#define P_ISDELETED(opaque) ((opaque)->btpo_flags & BTP_DELETED)
-#define P_ISMETA(opaque) ((opaque)->btpo_flags & BTP_META)
-#define P_ISHALFDEAD(opaque) ((opaque)->btpo_flags & BTP_HALF_DEAD)
-#define P_IGNORE(opaque) ((opaque)->btpo_flags & (BTP_DELETED|BTP_HALF_DEAD))
-#define P_HAS_GARBAGE(opaque) ((opaque)->btpo_flags & BTP_HAS_GARBAGE)
-#define P_INCOMPLETE_SPLIT(opaque) ((opaque)->btpo_flags & BTP_INCOMPLETE_SPLIT)
+#define P_ISLEAF(opaque) (((opaque)->btpo_flags & BTP_LEAF) != 0)
+#define P_ISROOT(opaque) (((opaque)->btpo_flags & BTP_ROOT) != 0)
+#define P_ISDELETED(opaque) (((opaque)->btpo_flags & BTP_DELETED) != 0)
+#define P_ISMETA(opaque) (((opaque)->btpo_flags & BTP_META) != 0)
+#define P_ISHALFDEAD(opaque) (((opaque)->btpo_flags & BTP_HALF_DEAD) != 0)
+#define P_IGNORE(opaque) (((opaque)->btpo_flags & (BTP_DELETED|BTP_HALF_DEAD)) != 0)
+#define P_HAS_GARBAGE(opaque) (((opaque)->btpo_flags & BTP_HAS_GARBAGE) != 0)
+#define P_INCOMPLETE_SPLIT(opaque) (((opaque)->btpo_flags & BTP_INCOMPLETE_SPLIT) != 0)
/*
* Lehman and Yao's algorithm requires a ``high key'' on every non-rightmost