From d2965f627fe35bfc9c212528159d95f46b8e83ef Mon Sep 17 00:00:00 2001 From: =?utf8?q?=C3=81lvaro=20Herrera?= Date: Thu, 6 Nov 2025 19:08:29 +0100 Subject: [PATCH] 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 Backpatch-through: 13 Discussion: https://postgr.es/m/aQB7EvGqrbZXrMlg@ip-10-97-1-34.eu-west-3.compute.internal --- src/include/access/xlogdefs.h | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/include/access/xlogdefs.h b/src/include/access/xlogdefs.h index 0940b64ca6b..aeb4a317324 100644 --- a/src/include/access/xlogdefs.h +++ b/src/include/access/xlogdefs.h @@ -25,7 +25,8 @@ typedef uint64 XLogRecPtr; * WAL segment, initializing the first WAL page at WAL segment size, so no XLOG * record can begin at zero. */ -#define InvalidXLogRecPtr 0 +#define InvalidXLogRecPtr 0 +#define XLogRecPtrIsValid(r) ((r) != InvalidXLogRecPtr) #define XLogRecPtrIsInvalid(r) ((r) == InvalidXLogRecPtr) /* -- 2.47.3