1
0
mirror of https://github.com/postgres/postgres.git synced 2025-11-09 06:21:09 +03:00

Remove AssertArg and AssertState

These don't offer anything over plain Assert, and their usage had
already been declared obsolescent.

Author: Nathan Bossart <nathandbossart@gmail.com>
Reviewed-by: Michael Paquier <michael@paquier.xyz>
Discussion: https://www.postgresql.org/message-id/20221009210148.GA900071@nathanxps13
This commit is contained in:
Peter Eisentraut
2022-10-28 09:19:06 +02:00
parent d37aa3d358
commit b1099eca8f
44 changed files with 162 additions and 174 deletions

View File

@@ -49,7 +49,7 @@ CreateTemplateTupleDesc(int natts)
/*
* sanity checks
*/
AssertArg(natts >= 0);
Assert(natts >= 0);
/*
* Allocate enough memory for the tuple descriptor, including the
@@ -273,12 +273,12 @@ TupleDescCopyEntry(TupleDesc dst, AttrNumber dstAttno,
/*
* sanity checks
*/
AssertArg(PointerIsValid(src));
AssertArg(PointerIsValid(dst));
AssertArg(srcAttno >= 1);
AssertArg(srcAttno <= src->natts);
AssertArg(dstAttno >= 1);
AssertArg(dstAttno <= dst->natts);
Assert(PointerIsValid(src));
Assert(PointerIsValid(dst));
Assert(srcAttno >= 1);
Assert(srcAttno <= src->natts);
Assert(dstAttno >= 1);
Assert(dstAttno <= dst->natts);
memcpy(dstAtt, srcAtt, ATTRIBUTE_FIXED_PART_SIZE);
@@ -594,9 +594,9 @@ TupleDescInitEntry(TupleDesc desc,
/*
* sanity checks
*/
AssertArg(PointerIsValid(desc));
AssertArg(attributeNumber >= 1);
AssertArg(attributeNumber <= desc->natts);
Assert(PointerIsValid(desc));
Assert(attributeNumber >= 1);
Assert(attributeNumber <= desc->natts);
/*
* initialize the attribute fields
@@ -664,9 +664,9 @@ TupleDescInitBuiltinEntry(TupleDesc desc,
Form_pg_attribute att;
/* sanity checks */
AssertArg(PointerIsValid(desc));
AssertArg(attributeNumber >= 1);
AssertArg(attributeNumber <= desc->natts);
Assert(PointerIsValid(desc));
Assert(attributeNumber >= 1);
Assert(attributeNumber <= desc->natts);
/* initialize the attribute fields */
att = TupleDescAttr(desc, attributeNumber - 1);
@@ -767,9 +767,9 @@ TupleDescInitEntryCollation(TupleDesc desc,
/*
* sanity checks
*/
AssertArg(PointerIsValid(desc));
AssertArg(attributeNumber >= 1);
AssertArg(attributeNumber <= desc->natts);
Assert(PointerIsValid(desc));
Assert(attributeNumber >= 1);
Assert(attributeNumber <= desc->natts);
TupleDescAttr(desc, attributeNumber - 1)->attcollation = collationid;
}

View File

@@ -2281,7 +2281,7 @@ heap_multi_insert(Relation relation, TupleTableSlot **slots, int ntuples,
bool need_cids = RelationIsAccessibleInLogicalDecoding(relation);
/* currently not needed (thus unsupported) for heap_multi_insert() */
AssertArg(!(options & HEAP_INSERT_NO_LOGICAL));
Assert(!(options & HEAP_INSERT_NO_LOGICAL));
needwal = RelationNeedsWAL(relation);
saveFreeSpace = RelationGetTargetPageFreeSpace(relation,

View File

@@ -1226,7 +1226,7 @@ _bt_load(BTWriteState *wstate, BTSpool *btspool, BTSpool *btspool2)
/* Abbreviation is not supported here */
sortKey->abbreviate = false;
AssertState(sortKey->ssup_attno != 0);
Assert(sortKey->ssup_attno != 0);
strategy = (scanKey->sk_flags & SK_BT_DESC) != 0 ?
BTGreaterStrategyNumber : BTLessStrategyNumber;

View File

@@ -389,8 +389,8 @@ MultiXactIdCreate(TransactionId xid1, MultiXactStatus status1,
MultiXactId newMulti;
MultiXactMember members[2];
AssertArg(TransactionIdIsValid(xid1));
AssertArg(TransactionIdIsValid(xid2));
Assert(TransactionIdIsValid(xid1));
Assert(TransactionIdIsValid(xid2));
Assert(!TransactionIdEquals(xid1, xid2) || (status1 != status2));
@@ -445,8 +445,8 @@ MultiXactIdExpand(MultiXactId multi, TransactionId xid, MultiXactStatus status)
int i;
int j;
AssertArg(MultiXactIdIsValid(multi));
AssertArg(TransactionIdIsValid(xid));
Assert(MultiXactIdIsValid(multi));
Assert(TransactionIdIsValid(xid));
/* MultiXactIdSetOldestMember() must have been called already. */
Assert(MultiXactIdIsValid(OldestMemberMXactId[MyBackendId]));

View File

@@ -3250,7 +3250,7 @@ CommitTransactionCommand(void)
s->savepointLevel = savepointLevel;
/* This is the same as TBLOCK_SUBBEGIN case */
AssertState(s->blockState == TBLOCK_SUBBEGIN);
Assert(s->blockState == TBLOCK_SUBBEGIN);
StartSubTransaction();
s->blockState = TBLOCK_SUBINPROGRESS;
}
@@ -3278,7 +3278,7 @@ CommitTransactionCommand(void)
s->savepointLevel = savepointLevel;
/* This is the same as TBLOCK_SUBBEGIN case */
AssertState(s->blockState == TBLOCK_SUBBEGIN);
Assert(s->blockState == TBLOCK_SUBBEGIN);
StartSubTransaction();
s->blockState = TBLOCK_SUBINPROGRESS;
}
@@ -4667,7 +4667,7 @@ RollbackAndReleaseCurrentSubTransaction(void)
CleanupSubTransaction();
s = CurrentTransactionState; /* changed by pop */
AssertState(s->blockState == TBLOCK_SUBINPROGRESS ||
Assert(s->blockState == TBLOCK_SUBINPROGRESS ||
s->blockState == TBLOCK_INPROGRESS ||
s->blockState == TBLOCK_IMPLICIT_INPROGRESS ||
s->blockState == TBLOCK_STARTED);