summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorÁlvaro Herrera2025-11-06 18:08:29 +0000
committerÁlvaro Herrera2025-11-06 18:08:29 +0000
commit20bafb0972882eaf0fb50349fc4023e1e5505a57 (patch)
treeacaf23f7837d6acd2c0a6ee4382ad9424369cdb9
parent3717849e622d6d38be8f021cf230903d70926d5a (diff)
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
-rw-r--r--src/include/access/xlogdefs.h3
1 files changed, 2 insertions, 1 deletions
diff --git a/src/include/access/xlogdefs.h b/src/include/access/xlogdefs.h
index e1f58122131..f2c7946e0ee 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)
/*