public inbox for [email protected]
help / color / mirror / Atom feedFrom: vignesh C <[email protected]>
To: PostgreSQL Hackers <[email protected]>
Subject: Use XLogRecPtrIsValid() instead of negated XLogRecPtrIsInvalid
Date: Fri, 10 Apr 2026 11:41:35 +0530
Message-ID: <CALDaNm16knMFtcqyAG3XYSkyagmVXfhaR0T=hau8UTAU0+eLQQ@mail.gmail.com> (raw)
Hi,
This small cleanup patch updates src/bin/pg_waldump/archive_waldump.c
to use the recently introduced XLogRecPtrIsValid() helper instead of
negating XLogRecPtrIsInvalid(). The current code uses double-negative
checks such as:
Assert(!XLogRecPtrIsInvalid(privateInfo->startptr));
if (!XLogRecPtrIsInvalid(privateInfo->endptr))
This patch changes them to:
Assert(XLogRecPtrIsValid(privateInfo->startptr));
if (XLogRecPtrIsValid(privateInfo->endptr))
This improves readability without changing behavior. The attached
patch has the changes for the same.
Regards,
Vignesh
Attachments:
[application/octet-stream] 0001-Remove-double-negative-XLogRecPtr-checks.patch (1.3K, 2-0001-Remove-double-negative-XLogRecPtr-checks.patch)
download | inline diff:
From 3b8308b9907afa19300d8dbce9ce5794b4319a83 Mon Sep 17 00:00:00 2001
From: Vignesh C <[email protected]>
Date: Fri, 10 Apr 2026 10:12:38 +0530
Subject: [PATCH] Remove double-negative XLogRecPtr checks
Replace negated XLogRecPtrIsInvalid() checks in
init_archive_reader() with XLogRecPtrIsValid().
This improves readability by avoiding double negatives,
with no functional change intended.
---
src/bin/pg_waldump/archive_waldump.c | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/src/bin/pg_waldump/archive_waldump.c b/src/bin/pg_waldump/archive_waldump.c
index e4a4bf44a7e..ff4c9276d31 100644
--- a/src/bin/pg_waldump/archive_waldump.c
+++ b/src/bin/pg_waldump/archive_waldump.c
@@ -216,11 +216,11 @@ init_archive_reader(XLogDumpPrivate *privateInfo,
* With the WAL segment size available, we can now initialize the
* dependent start and end segment numbers.
*/
- Assert(!XLogRecPtrIsInvalid(privateInfo->startptr));
+ Assert(XLogRecPtrIsValid(privateInfo->startptr));
XLByteToSeg(privateInfo->startptr, privateInfo->start_segno,
privateInfo->segsize);
- if (!XLogRecPtrIsInvalid(privateInfo->endptr))
+ if (XLogRecPtrIsValid(privateInfo->endptr))
XLByteToSeg(privateInfo->endptr, privateInfo->end_segno,
privateInfo->segsize);
--
2.43.0
view thread (9+ messages) latest in thread
reply
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Reply to all the recipients using the --to and --cc options:
reply via email
To: [email protected]
Cc: [email protected], [email protected]
Subject: Re: Use XLogRecPtrIsValid() instead of negated XLogRecPtrIsInvalid
In-Reply-To: <CALDaNm16knMFtcqyAG3XYSkyagmVXfhaR0T=hau8UTAU0+eLQQ@mail.gmail.com>
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
This inbox is served by agora; see mirroring instructions
for how to clone and mirror all data and code used for this inbox