1
0
mirror of https://github.com/postgres/postgres.git synced 2025-11-18 02:02:55 +03:00

Remove PointerIsValid()

This doesn't provide any value over the standard style of checking the
pointer directly or comparing against NULL.

Also remove related:
- AllocPointerIsValid() [unused]
- IndexScanIsValid() [had one user]
- HeapScanIsValid() [unused]
- InvalidRelation [unused]

Leaving HeapTupleIsValid(), ItemIdIsValid(), PortalIsValid(),
RelationIsValid for now, to reduce code churn.

Reviewed-by: Jacob Champion <jacob.champion@enterprisedb.com>
Discussion: https://www.postgresql.org/message-id/flat/ad50ab6b-6f74-4603-b099-1cd6382fb13d%40eisentraut.org
Discussion: https://www.postgresql.org/message-id/CA+hUKG+NFKnr=K4oybwDvT35dW=VAjAAfiuLxp+5JeZSOV3nBg@mail.gmail.com
Discussion: https://www.postgresql.org/message-id/bccf2803-5252-47c2-9ff0-340502d5bd1c@iki.fi
This commit is contained in:
Peter Eisentraut
2025-09-24 15:14:06 +02:00
parent 0fba25eb72
commit a5b35fcedb
37 changed files with 97 additions and 132 deletions

View File

@@ -331,7 +331,7 @@ CleanupInvalidationState(int status, Datum arg)
ProcState *stateP;
int i;
Assert(PointerIsValid(segP));
Assert(segP);
LWLockAcquire(SInvalWriteLock, LW_EXCLUSIVE);

View File

@@ -298,7 +298,7 @@ inv_open(Oid lobjId, int flags, MemoryContext mcxt)
void
inv_close(LargeObjectDesc *obj_desc)
{
Assert(PointerIsValid(obj_desc));
Assert(obj_desc);
pfree(obj_desc);
}
@@ -344,7 +344,7 @@ inv_getsize(LargeObjectDesc *obj_desc)
SysScanDesc sd;
HeapTuple tuple;
Assert(PointerIsValid(obj_desc));
Assert(obj_desc);
open_lo_relation();
@@ -389,7 +389,7 @@ inv_seek(LargeObjectDesc *obj_desc, int64 offset, int whence)
{
int64 newoffset;
Assert(PointerIsValid(obj_desc));
Assert(obj_desc);
/*
* We allow seek/tell if you have either read or write permission, so no
@@ -436,7 +436,7 @@ inv_seek(LargeObjectDesc *obj_desc, int64 offset, int whence)
int64
inv_tell(LargeObjectDesc *obj_desc)
{
Assert(PointerIsValid(obj_desc));
Assert(obj_desc);
/*
* We allow seek/tell if you have either read or write permission, so no
@@ -459,7 +459,7 @@ inv_read(LargeObjectDesc *obj_desc, char *buf, int nbytes)
SysScanDesc sd;
HeapTuple tuple;
Assert(PointerIsValid(obj_desc));
Assert(obj_desc);
Assert(buf != NULL);
if ((obj_desc->flags & IFS_RDLOCK) == 0)
@@ -569,7 +569,7 @@ inv_write(LargeObjectDesc *obj_desc, const char *buf, int nbytes)
bool replace[Natts_pg_largeobject];
CatalogIndexState indstate;
Assert(PointerIsValid(obj_desc));
Assert(obj_desc);
Assert(buf != NULL);
/* enforce writability because snapshot is probably wrong otherwise */
@@ -760,7 +760,7 @@ inv_truncate(LargeObjectDesc *obj_desc, int64 len)
bool replace[Natts_pg_largeobject];
CatalogIndexState indstate;
Assert(PointerIsValid(obj_desc));
Assert(obj_desc);
/* enforce writability because snapshot is probably wrong otherwise */
if ((obj_desc->flags & IFS_WRLOCK) == 0)