Skip to content

Commit 723cc84

Browse files
committed
Introduce XLogRecPtrIsValid()
XLogRecPtrIsInvalid() is inconsistent with the affirmative form of macros used for other datatypes, and leads to awkward double negatives in a few places. This commit introduces XLogRecPtrIsValid(), which allows code to be written more naturally. This patch only adds the new macro. XLogRecPtrIsInvalid() is left in place, and all existing callers remain untouched. This means all supported branches can accept hypothetical bug fixes that use the new macro, and at the same time any code that compiled with the original formulation will continue to silently compile just fine. Author: Bertrand Drouvot <bertranddrouvot.pg@gmail.com> Backpatch-through: 13 Discussion: https://postgr.es/m/aQB7EvGqrbZXrMlg@ip-10-97-1-34.eu-west-3.compute.internal
1 parent 26958f4 commit 723cc84

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

src/include/access/xlogdefs.h

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,8 @@ typedef uint64 XLogRecPtr;
2525
* WAL segment, initializing the first WAL page at WAL segment size, so no XLOG
2626
* record can begin at zero.
2727
*/
28-
#define InvalidXLogRecPtr 0
28+
#define InvalidXLogRecPtr 0
29+
#define XLogRecPtrIsValid(r) ((r) != InvalidXLogRecPtr)
2930
#define XLogRecPtrIsInvalid(r) ((r) == InvalidXLogRecPtr)
3031

3132
/*

0 commit comments

Comments
 (0)