1
0
mirror of https://github.com/postgres/postgres.git synced 2025-11-06 07:49:08 +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

@@ -5159,7 +5159,7 @@ roles_is_member_of(Oid roleid, enum RoleRecurseType type,
MemoryContext oldctx;
bloom_filter *bf = NULL;
Assert(OidIsValid(admin_of) == PointerIsValid(admin_role));
Assert(OidIsValid(admin_of) == (admin_role != NULL));
if (admin_role != NULL)
*admin_role = InvalidOid;

View File

@@ -4601,7 +4601,7 @@ array_create_iterator(ArrayType *arr, int slice_ndim, ArrayMetaState *mstate)
/*
* Sanity-check inputs --- caller should have got this right already
*/
Assert(PointerIsValid(arr));
Assert(arr);
if (slice_ndim < 0 || slice_ndim > ARR_NDIM(arr))
elog(ERROR, "invalid arguments to array_create_iterator");

View File

@@ -84,7 +84,7 @@ datumGetSize(Datum value, bool typByVal, int typLen)
/* It is a varlena datatype */
struct varlena *s = (struct varlena *) DatumGetPointer(value);
if (!PointerIsValid(s))
if (!s)
ereport(ERROR,
(errcode(ERRCODE_DATA_EXCEPTION),
errmsg("invalid Datum pointer")));
@@ -96,7 +96,7 @@ datumGetSize(Datum value, bool typByVal, int typLen)
/* It is a cstring datatype */
char *s = (char *) DatumGetPointer(value);
if (!PointerIsValid(s))
if (!s)
ereport(ERROR,
(errcode(ERRCODE_DATA_EXCEPTION),
errmsg("invalid Datum pointer")));

View File

@@ -4895,7 +4895,7 @@ XmlTableSetColumnFilter(TableFuncScanState *state, const char *path, int colnum)
XmlTableBuilderData *xtCxt;
xmlChar *xstr;
Assert(PointerIsValid(path));
Assert(path);
xtCxt = GetXmlTableBuilderPrivateData(state, "XmlTableSetColumnFilter");