Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit594e61a

Browse files
committed
Change some test macros to return true booleans
These macros work fine when they are used directly in an "if" test orsimilar, but as soon as the return values are assigned to booleanvariables (or passed as boolean arguments to some function), they becomebugs, 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-patchedfixes that only work correctly in branches starting from the currentmaster and not in old ones, back-patch the change to supported branchesas appropriate.See also commitaf4472b, and the longdiscussion (and larger patch) in the thread mentioned in its commitmessage.Discussion:https://postgr.es/m/18672.1483022414@sss.pgh.pa.us
1 parentd00ca33 commit594e61a

File tree

1 file changed

+5
-5
lines changed

1 file changed

+5
-5
lines changed

‎src/include/access/htup_details.h

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -237,8 +237,8 @@ struct HeapTupleHeaderData
237237
*/
238238
#defineHEAP_LOCKED_UPGRADED(infomask) \
239239
( \
240-
((infomask) & HEAP_XMAX_IS_MULTI) && \
241-
((infomask) & HEAP_XMAX_LOCK_ONLY) && \
240+
((infomask) & HEAP_XMAX_IS_MULTI)!= 0&& \
241+
((infomask) & HEAP_XMAX_LOCK_ONLY)!= 0&& \
242242
(((infomask) & (HEAP_XMAX_EXCL_LOCK | HEAP_XMAX_KEYSHR_LOCK)) == 0) \
243243
)
244244

@@ -317,7 +317,7 @@ struct HeapTupleHeaderData
317317

318318
#defineHeapTupleHeaderXminCommitted(tup) \
319319
( \
320-
(tup)->t_infomask & HEAP_XMIN_COMMITTED \
320+
((tup)->t_infomask & HEAP_XMIN_COMMITTED) != 0 \
321321
)
322322

323323
#defineHeapTupleHeaderXminInvalid(tup) \
@@ -501,7 +501,7 @@ do { \
501501

502502
#defineHeapTupleHeaderIsHeapOnly(tup) \
503503
( \
504-
(tup)->t_infomask2 & HEAP_ONLY_TUPLE \
504+
((tup)->t_infomask2 & HEAP_ONLY_TUPLE) != 0 \
505505
)
506506

507507
#defineHeapTupleHeaderSetHeapOnly(tup) \
@@ -516,7 +516,7 @@ do { \
516516

517517
#defineHeapTupleHeaderHasMatch(tup) \
518518
( \
519-
(tup)->t_infomask2 & HEAP_TUPLE_HAS_MATCH \
519+
((tup)->t_infomask2 & HEAP_TUPLE_HAS_MATCH) != 0 \
520520
)
521521

522522
#defineHeapTupleHeaderSetMatch(tup) \

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp