1
0
mirror of https://github.com/postgres/postgres.git synced 2025-11-10 17:42:29 +03:00

Use XLogRecPtrIsValid() in various places

Now that commit 06edbed478 has introduced XLogRecPtrIsValid(), we can
use that instead of:

- XLogRecPtrIsInvalid()
- direct comparisons with InvalidXLogRecPtr
- direct comparisons with literal 0

This makes the code more consistent.

Author: Bertrand Drouvot <bertranddrouvot.pg@gmail.com>
Discussion: https://postgr.es/m/aQB7EvGqrbZXrMlg@ip-10-97-1-34.eu-west-3.compute.internal
This commit is contained in:
Álvaro Herrera
2025-11-06 20:33:57 +01:00
parent 06edbed478
commit a2b02293bc
46 changed files with 239 additions and 238 deletions

View File

@@ -231,7 +231,7 @@ WALOpenSegmentInit(WALOpenSegment *seg, WALSegmentContext *segcxt,
void
XLogBeginRead(XLogReaderState *state, XLogRecPtr RecPtr)
{
Assert(!XLogRecPtrIsInvalid(RecPtr));
Assert(XLogRecPtrIsValid(RecPtr));
ResetDecoder(state);
@@ -343,7 +343,7 @@ XLogNextRecord(XLogReaderState *state, char **errormsg)
* XLogBeginRead() or XLogNextRecord(), and is the location of the
* error.
*/
Assert(!XLogRecPtrIsInvalid(state->EndRecPtr));
Assert(XLogRecPtrIsValid(state->EndRecPtr));
return NULL;
}
@@ -558,7 +558,7 @@ XLogDecodeNextRecord(XLogReaderState *state, bool nonblocking)
RecPtr = state->NextRecPtr;
if (state->DecodeRecPtr != InvalidXLogRecPtr)
if (XLogRecPtrIsValid(state->DecodeRecPtr))
{
/* read the record after the one we just read */
@@ -1398,7 +1398,7 @@ XLogFindNextRecord(XLogReaderState *state, XLogRecPtr RecPtr)
XLogPageHeader header;
char *errormsg;
Assert(!XLogRecPtrIsInvalid(RecPtr));
Assert(XLogRecPtrIsValid(RecPtr));
/* Make sure ReadPageInternal() can't return XLREAD_WOULDBLOCK. */
state->nonblocking = false;