summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAlvaro Herrera <alvherre@alvh.no-ip.org>2017-01-18 18:06:13 -0300
committerAlvaro Herrera <alvherre@alvh.no-ip.org>2017-01-18 18:06:13 -0300
commit5462e3486dfeb5876d1c5a408eecab12b9fc4545 (patch)
tree1e50188f385b052a3f6014562a6cd5890ae602ee
parentc73157ca0e058806a956b8126f158dcb513b1881 (diff)
downloadpostgresql-5462e3486dfeb5876d1c5a408eecab12b9fc4545.tar.gz
Change some test macros to return true booleans
These macros work fine when they are used directly in an "if" test or similar, but as soon as the return values are assigned to boolean variables (or passed as boolean arguments to some function), they become bugs, hopefully caught by compiler warnings. To avoid future problems, fix the definitions so that they return actual booleans. To further minimize the risk that somebody uses them in back-patched fixes that only work correctly in branches starting from the current master and not in old ones, back-patch the change to supported branches as appropriate. See also commit af4472bcb88ab36b9abbe7fd5858e570a65a2d1a, and the long discussion (and larger patch) in the thread mentioned in its commit message. Discussion: https://postgr.es/m/18672.1483022414@sss.pgh.pa.us
-rw-r--r--src/include/access/htup.h4
1 files changed, 2 insertions, 2 deletions
diff --git a/src/include/access/htup.h b/src/include/access/htup.h
index 0e1bb4f5b7..d7af849460 100644
--- a/src/include/access/htup.h
+++ b/src/include/access/htup.h
@@ -339,7 +339,7 @@ do { \
#define HeapTupleHeaderIsHeapOnly(tup) \
( \
- (tup)->t_infomask2 & HEAP_ONLY_TUPLE \
+ ((tup)->t_infomask2 & HEAP_ONLY_TUPLE) != 0 \
)
#define HeapTupleHeaderSetHeapOnly(tup) \
@@ -354,7 +354,7 @@ do { \
#define HeapTupleHeaderHasMatch(tup) \
( \
- (tup)->t_infomask2 & HEAP_TUPLE_HAS_MATCH \
+ ((tup)->t_infomask2 & HEAP_TUPLE_HAS_MATCH) != 0 \
)
#define HeapTupleHeaderSetMatch(tup) \