10000 Remove AssertArg and AssertState · postgrespro/postgres@b1099ec · GitHub
[go: up one dir, main page]

Skip to content

Commit b1099ec

Browse files
committed
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
1 parent d37aa3d commit b1099ec

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

44 files changed

+162
-174
lines changed

contrib/fuzzystrmatch/fuzzystrmatch.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -724,8 +724,8 @@ _soundex(const char *instr, char *outstr)
724724
{
725725
int count;
726726

727-
AssertArg(instr);
728-
AssertArg(outstr);
727+
Assert(instr);
728+
Assert(outstr);
729729

730730
outstr[SOUNDEX_LEN] = '\0';
731731

src/backend/access/common/tupdesc.c

Lines changed: 16 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -49,7 +49,7 @@ CreateTemplateTupleDesc(int natts)
4949
/*
5050
* sanity checks
5151
*/
52-
AssertArg(natts >= 0);
52+
Assert(natts >= 0);
5353

5454
/*
5555
* Allocate enough memory for the tuple descriptor, including the
@@ -273,12 +273,12 @@ TupleDescCopyEntry(TupleDesc dst, AttrNumber dstAttno,
273273
/*
274274
* sanity checks
275275
*/
276-
AssertArg(PointerIsValid(src));
277-
AssertArg(PointerIsValid(dst));
278-
AssertArg(srcAttno >= 1);
279-
AssertArg(srcAttno <= src->natts);
280-
AssertArg(dstAttno >= 1);
281-
AssertArg(dstAttno <= dst->natts);
276+
Assert(PointerIsValid(src));
277+
Assert(PointerIsValid(dst));
278+
Assert(srcAttno >= 1);
279+
Assert(srcAttno <= src->natts);
280+
Assert(dstAttno >= 1);
281+
Assert(dstAttno <= dst->natts);
282282

283283
memcpy(dstAtt, srcAtt, ATTRIBUTE_FIXED_PART_SIZE);
284284

@@ -594,9 +594,9 @@ TupleDescInitEntry(TupleDesc desc,
594594
/*
595595
* sanity checks
596596
*/
597-
AssertArg(PointerIsValid(desc));
598-
AssertArg(attributeNumber >= 1);
599-
AssertArg(attributeNumber <= desc->natts);
597+
Assert(PointerIsValid(desc));
598+
Assert(attributeNumber >= 1);
599+
Assert(attributeNumber <= desc->natts);
600600

601601
/*
602602
* initialize the attribute fields
@@ -664,9 +664,9 @@ TupleDescInitBuiltinEntry(TupleDesc desc,
664664
Form_pg_attribute att;
665665

666666
/* sanity checks */
667-
AssertArg(PointerIsValid(desc));
668-
AssertArg(attributeNumber >= 1);
669-
AssertArg(attributeNumber <= desc->natts);
667+
Assert(PointerIsValid(desc));
668+
Assert(attributeNumber >= 1);
669+
Assert(attributeNumber <= desc->natts);
670670

671671
/* initialize the attribute fields */
672672
att = TupleDescAttr(desc, attributeNumber - 1);
@@ -767,9 +767,9 @@ TupleDescInitEntryCollation(TupleDesc desc,
767767
/*
768768
* sanity checks
769769
*/
770-
AssertArg(PointerIsValid(desc));
771-
AssertArg(attributeNumber >= 1);
772-
AssertArg(attributeNumber <= desc->natts);
770+
Assert(PointerIsValid(desc));
771+
Assert(attributeNumber >= 1);
772+
Assert(attributeNumber <= desc->natts);
773773

774774
TupleDescAttr(desc, attributeNumber - 1)->attcollation = collationid;
775775
}

src/backend/access/heap/heapam.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2281,7 +2281,7 @@ heap_multi_insert(Relation relation, TupleTableSlot **slots, int ntuples,
22812281
bool need_cids = RelationIsAccessibleInLogicalDecoding(relation);
22822282

22832283
/* currently not needed (thus unsupported) for heap_multi_insert() */
2284-
AssertArg(!(options & HEAP_INSERT_NO_LOGICAL));
2284+
Assert(!(options & HEAP_INSERT_NO_LOGICAL));
22852285

22862286
needwal = RelationNeedsWAL(relation);
22872287
saveFreeSpace = RelationGetTargetPageFreeSpace(relation,

src/backend/access/nbtree/nbtsort.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1226,7 +1226,7 @@ _bt_load(BTWriteState *wstate, BTSpool *btspool, BTSpool *btspool2)
12261226
/* Abbreviation is not supported here */
12271227
sortKey->abbreviate = false;
12281228

1229-
AssertState(sortKey->ssup_attno != 0);
1229+
Assert(sortKey->ssup_attno != 0);
12301230

12311231
strategy = (scanKey->sk_flags & SK_BT_DESC) != 0 ?
12321232
BTGreaterStrategyNumber : BTLessStrategyNumber;

src/backend/access/transam/multixact.c

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -389,8 +389,8 @@ MultiXactIdCreate(TransactionId xid1, MultiXactStatus status1,
389389
MultiXactId newMulti;
390390
MultiXactMember members[2];
391391

392-
AssertArg(TransactionIdIsValid(xid1));
393-
AssertArg(TransactionIdIsValid(xid2));
392+
Assert(TransactionIdIsValid(xid1));
393+
Assert(TransactionIdIsValid(xid2));
394394

395395
Assert(!TransactionIdEquals(xid1, xid2) || (status1 != status2));
396396

@@ -445,8 +445,8 @@ MultiXactIdExpand(MultiXactId multi, TransactionId xid, MultiXactStatus status)
445445
int i;
446446
int j;
447447

448-
AssertArg(MultiXactIdIsValid(multi));
449-
AssertArg(TransactionIdIsValid(xid));
448+
Assert(MultiXactIdIsValid(multi));
449+
Assert(TransactionIdIsValid(xid));
450450

451451
/* MultiXactIdSetOldestMember() must have been called already. */
452452
Assert(MultiXactIdIsValid(OldestMemberMXactId[MyBackendId]));

src/backend/access/transam/xact.c

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3250,7 +3250,7 @@ CommitTransactionCommand(void)
32503250
s->savepointLevel = savepointLevel;
32513251

32523252
/* This is the same as TBLOCK_SUBBEGIN case */
3253-
AssertState(s->blockState == TBLOCK_SUBBEGIN);
3253+
Assert(s->blockState == TBLOCK_SUBBEGIN);
32543254
StartSubTransaction();
32553255
s->blockState = TBLOCK_SUBINPROGRESS;
32563256
}
@@ -3278,7 +3278,7 @@ CommitTransactionCommand(void)
32783278
s->savepointLevel = savepointLevel;
32793279

32803280
/* This is the same as TBLOCK_SUBBEGIN case */
3281-
AssertState(s->blockState == TBLOCK_SUBBEGIN);
3281+
Assert(s->blockState == TBLOCK_SUBBEGIN);
32823282
StartSubTransaction();
32833283
s->blockState = TBLOCK_SUBINPROGRESS;
32843284
}
@@ -4667,7 +4667,7 @@ RollbackAndReleaseCurrentSubTransaction(void)
46674667
CleanupSubTransaction();
46684668

46694669
s = CurrentTransactionState; /* changed by pop */
4670-
AssertState(s->blockState == TBLOCK_SUBINPROGRESS ||
4670+
Assert(s->blockState == TBLOCK_SUBINPROGRESS ||
46714671
s->blockState == TBLOCK_INPROGRESS ||
46724672
s->blockState == TBLOCK_IMPLICIT_INPROGRESS ||
46734673
s->blockState == TBLOCK_STARTED);

src/backend/bootstrap/bootstrap.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -648,7 +648,7 @@ InsertOneValue(char *value, int i)
648648
Oid typinput;
649649
Oid typoutput;
650650

651-
AssertArg(i >= 0 && i < MAXATTR);
651+
Assert(i >= 0 && i < MAXATTR);
652652

653653
elog(DEBUG4, "inserting column %d value \"%s\"", i, value);
654654

src/backend/catalog/namespace.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4093,7 +4093,7 @@ InitTempTableNamespace(void)
40934093
MyProc->tempNamespaceId = namespaceId;
40944094

40954095
/* It should not be done already. */
4096-
AssertState(myTempNamespaceSubID == InvalidSubTransactionId);
4096+
Assert(myTempNamespaceSubID == InvalidSubTransactionId);
40974097
myTempNamespaceSubID = GetCurrentSubTransactionId();
40984098

40994099
baseSearchPathValid = false; /* need to rebuild list */

src/backend/catalog/pg_collation.c

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -64,10 +64,10 @@ CollationCreate(const char *collname, Oid collnamespace,
6464
ObjectAddress myself,
6565
referenced;
6666

67-
AssertArg(collname);
68-
AssertArg(collnamespace);
69-
AssertArg(collowner);
70-
AssertArg((collcollate && collctype) || colliculocale);
67+
Assert(collname);
68+
Assert(collnamespace);
69+
Assert(collowner);
70+
Assert((collcollate && collctype) || colliculocale);
7171

7272
/*
7373
* Make sure there is no existing collation of same name & encoding.

src/backend/commands/dbcommands.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2606,7 +2606,7 @@ get_db_info(const char *name, LOCKMODE lockmode,
26062606
bool result = false;
26072607
Relation relation;
26082608

2609-
AssertArg(name);
2609+
Assert(name);
26102610

26112611
/* Caller may wish to grab a better lock on pg_database beforehand... */
26122612
relation = table_open(DatabaseRelationId, AccessShareLock);

0 commit comments

Comments
 (0)
0