Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit223be21

Browse files
committed
Undo overly enthusiastic de-const-ification.
s/const//g wasn't exactly what I was suggesting here ... parameterdeclarations of the form "const structtype *param" are good and useful,so put those occurrences back. Likewise, avoid casting away the constin a "const void *" parameter.
1 parent0b44818 commit223be21

File tree

1 file changed

+35
-36
lines changed

1 file changed

+35
-36
lines changed

‎src/backend/storage/lmgr/predicate.c

Lines changed: 35 additions & 36 deletions
Original file line numberDiff line numberDiff line change
@@ -388,7 +388,7 @@ static void ReleasePredXact(SERIALIZABLEXACT *sxact);
388388
staticSERIALIZABLEXACT*FirstPredXact(void);
389389
staticSERIALIZABLEXACT*NextPredXact(SERIALIZABLEXACT*sxact);
390390

391-
staticboolRWConflictExists(SERIALIZABLEXACT*reader,SERIALIZABLEXACT*writer);
391+
staticboolRWConflictExists(constSERIALIZABLEXACT*reader,constSERIALIZABLEXACT*writer);
392392
staticvoidSetRWConflict(SERIALIZABLEXACT*reader,SERIALIZABLEXACT*writer);
393393
staticvoidSetPossibleUnsafeConflict(SERIALIZABLEXACT*roXact,SERIALIZABLEXACT*activeXact);
394394
staticvoidReleaseRWConflict(RWConflictconflict);
@@ -404,26 +404,26 @@ static uint32 predicatelock_hash(const void *key, Size keysize);
404404
staticvoidSummarizeOldestCommittedSxact(void);
405405
staticSnapshotGetSafeSnapshot(Snapshotsnapshot);
406406
staticSnapshotRegisterSerializableTransactionInt(Snapshotsnapshot);
407-
staticboolPredicateLockExists(PREDICATELOCKTARGETTAG*targettag);
408-
staticboolGetParentPredicateLockTag(PREDICATELOCKTARGETTAG*tag,
407+
staticboolPredicateLockExists(constPREDICATELOCKTARGETTAG*targettag);
408+
staticboolGetParentPredicateLockTag(constPREDICATELOCKTARGETTAG*tag,
409409
PREDICATELOCKTARGETTAG*parent);
410-
staticboolCoarserLockCovers(PREDICATELOCKTARGETTAG*newtargettag);
410+
staticboolCoarserLockCovers(constPREDICATELOCKTARGETTAG*newtargettag);
411411
staticvoidRemoveScratchTarget(boollockheld);
412412
staticvoidRestoreScratchTarget(boollockheld);
413413
staticvoidRemoveTargetIfNoLongerUsed(PREDICATELOCKTARGET*target,
414414
uint32targettaghash);
415-
staticvoidDeleteChildTargetLocks(PREDICATELOCKTARGETTAG*newtargettag);
416-
staticintPredicateLockPromotionThreshold(PREDICATELOCKTARGETTAG*tag);
417-
staticboolCheckAndPromotePredicateLockRequest(PREDICATELOCKTARGETTAG*reqtag);
418-
staticvoidDecrementParentLocks(PREDICATELOCKTARGETTAG*targettag);
419-
staticvoidCreatePredicateLock(PREDICATELOCKTARGETTAG*targettag,
415+
staticvoidDeleteChildTargetLocks(constPREDICATELOCKTARGETTAG*newtargettag);
416+
staticintPredicateLockPromotionThreshold(constPREDICATELOCKTARGETTAG*tag);
417+
staticboolCheckAndPromotePredicateLockRequest(constPREDICATELOCKTARGETTAG*reqtag);
418+
staticvoidDecrementParentLocks(constPREDICATELOCKTARGETTAG*targettag);
419+
staticvoidCreatePredicateLock(constPREDICATELOCKTARGETTAG*targettag,
420420
uint32targettaghash,
421421
SERIALIZABLEXACT*sxact);
422422
staticvoidDeleteLockTarget(PREDICATELOCKTARGET*target,uint32targettaghash);
423423
staticboolTransferPredicateLocksToNewTarget(PREDICATELOCKTARGETTAGoldtargettag,
424424
PREDICATELOCKTARGETTAGnewtargettag,
425425
boolremoveOld);
426-
staticvoidPredicateLockAcquire(PREDICATELOCKTARGETTAG*targettag);
426+
staticvoidPredicateLockAcquire(constPREDICATELOCKTARGETTAG*targettag);
427427
staticvoidDropAllPredicateLocksFromTable(Relationrelation,
428428
booltransfer);
429429
staticvoidSetNewSxactGlobalXmin(void);
@@ -433,7 +433,7 @@ static void ReleaseOneSerializableXact(SERIALIZABLEXACT *sxact, bool partial,
433433
staticboolXidIsConcurrent(TransactionIdxid);
434434
staticvoidCheckTargetForConflictsIn(PREDICATELOCKTARGETTAG*targettag);
435435
staticvoidFlagRWConflict(SERIALIZABLEXACT*reader,SERIALIZABLEXACT*writer);
436-
staticvoidOnConflict_CheckForSerializationFailure(SERIALIZABLEXACT*reader,
436+
staticvoidOnConflict_CheckForSerializationFailure(constSERIALIZABLEXACT*reader,
437437
SERIALIZABLEXACT*writer);
438438

439439

@@ -601,7 +601,7 @@ NextPredXact(SERIALIZABLEXACT *sxact)
601601
* These functions manage primitive access to the RWConflict pool and lists.
602602
*/
603603
staticbool
604-
RWConflictExists(SERIALIZABLEXACT*reader,SERIALIZABLEXACT*writer)
604+
RWConflictExists(constSERIALIZABLEXACT*reader,constSERIALIZABLEXACT*writer)
605605
{
606606
RWConflictconflict;
607607

@@ -1337,7 +1337,7 @@ PredicateLockShmemSize(void)
13371337
staticuint32
13381338
predicatelock_hash(constvoid*key,Sizekeysize)
13391339
{
1340-
PREDICATELOCKTAG*predicatelocktag= (PREDICATELOCKTAG*)key;
1340+
constPREDICATELOCKTAG*predicatelocktag= (constPREDICATELOCKTAG*)key;
13411341
uint32targethash;
13421342

13431343
Assert(keysize==sizeof(PREDICATELOCKTAG));
@@ -1785,7 +1785,7 @@ PageIsPredicateLocked(Relation relation, BlockNumber blkno)
17851785
* acceptable!
17861786
*/
17871787
staticbool
1788-
PredicateLockExists(PREDICATELOCKTARGETTAG*targettag)
1788+
PredicateLockExists(constPREDICATELOCKTARGETTAG*targettag)
17891789
{
17901790
LOCALPREDICATELOCK*lock;
17911791

@@ -1812,7 +1812,7 @@ PredicateLockExists(PREDICATELOCKTARGETTAG *targettag)
18121812
* returns false if none exists.
18131813
*/
18141814
staticbool
1815-
GetParentPredicateLockTag(PREDICATELOCKTARGETTAG*tag,
1815+
GetParentPredicateLockTag(constPREDICATELOCKTARGETTAG*tag,
18161816
PREDICATELOCKTARGETTAG*parent)
18171817
{
18181818
switch (GET_PREDICATELOCKTARGETTAG_TYPE(*tag))
@@ -1851,7 +1851,7 @@ GetParentPredicateLockTag(PREDICATELOCKTARGETTAG *tag,
18511851
* negative, but it will never return a false positive.
18521852
*/
18531853
staticbool
1854-
CoarserLockCovers(PREDICATELOCKTARGETTAG*newtargettag)
1854+
CoarserLockCovers(constPREDICATELOCKTARGETTAG*newtargettag)
18551855
{
18561856
PREDICATELOCKTARGETTAGtargettag,
18571857
parenttag;
@@ -1952,7 +1952,7 @@ RemoveTargetIfNoLongerUsed(PREDICATELOCKTARGET *target, uint32 targettaghash)
19521952
* locks.
19531953
*/
19541954
staticvoid
1955-
DeleteChildTargetLocks(PREDICATELOCKTARGETTAG*newtargettag)
1955+
DeleteChildTargetLocks(constPREDICATELOCKTARGETTAG*newtargettag)
19561956
{
19571957
SERIALIZABLEXACT*sxact;
19581958
PREDICATELOCK*predlock;
@@ -2029,7 +2029,7 @@ DeleteChildTargetLocks(PREDICATELOCKTARGETTAG *newtargettag)
20292029
* entirely arbitrarily (and without benchmarking).
20302030
*/
20312031
staticint
2032-
PredicateLockPromotionThreshold(PREDICATELOCKTARGETTAG*tag)
2032+
PredicateLockPromotionThreshold(constPREDICATELOCKTARGETTAG*tag)
20332033
{
20342034
switch (GET_PREDICATELOCKTARGETTAG_TYPE(*tag))
20352035
{
@@ -2063,7 +2063,7 @@ PredicateLockPromotionThreshold(PREDICATELOCKTARGETTAG *tag)
20632063
* Returns true if a parent lock was acquired and false otherwise.
20642064
*/
20652065
staticbool
2066-
CheckAndPromotePredicateLockRequest(PREDICATELOCKTARGETTAG*reqtag)
2066+
CheckAndPromotePredicateLockRequest(constPREDICATELOCKTARGETTAG*reqtag)
20672067
{
20682068
PREDICATELOCKTARGETTAGtargettag,
20692069
nexttag,
@@ -2128,7 +2128,7 @@ CheckAndPromotePredicateLockRequest(PREDICATELOCKTARGETTAG *reqtag)
21282128
* this information is no longer needed.
21292129
*/
21302130
staticvoid
2131-
DecrementParentLocks(PREDICATELOCKTARGETTAG*targettag)
2131+
DecrementParentLocks(constPREDICATELOCKTARGETTAG*targettag)
21322132
{
21332133
PREDICATELOCKTARGETTAGparenttag,
21342134
nexttag;
@@ -2190,7 +2190,7 @@ DecrementParentLocks(PREDICATELOCKTARGETTAG *targettag)
21902190
* PredicateLockAcquire for that.
21912191
*/
21922192
staticvoid
2193-
CreatePredicateLock(PREDICATELOCKTARGETTAG*targettag,
2193+
CreatePredicateLock(constPREDICATELOCKTARGETTAG*targettag,
21942194
uint32targettaghash,
21952195
SERIALIZABLEXACT*sxact)
21962196
{
@@ -2251,7 +2251,7 @@ CreatePredicateLock(PREDICATELOCKTARGETTAG *targettag,
22512251
* any finer-grained locks covered by the new one.
22522252
*/
22532253
staticvoid
2254-
PredicateLockAcquire(PREDICATELOCKTARGETTAG*targettag)
2254+
PredicateLockAcquire(constPREDICATELOCKTARGETTAG*targettag)
22552255
{
22562256
uint32targettaghash;
22572257
boolfound;
@@ -2613,14 +2613,13 @@ TransferPredicateLocksToNewTarget(PREDICATELOCKTARGETTAG oldtargettag,
26132613
Assert(found);
26142614
}
26152615

2616-
26172616
newpredlock= (PREDICATELOCK*)
2618-
hash_search_with_hash_value
2619-
(PredicateLockHash,
2620-
&newpredlocktag,
2621-
PredicateLockHashCodeFromTargetHashCode(&newpredlocktag,
2622-
newtargettaghash),
2623-
HASH_ENTER_NULL,&found);
2617+
hash_search_with_hash_value(PredicateLockHash,
2618+
&newpredlocktag,
2619+
PredicateLockHashCodeFromTargetHashCode(&newpredlocktag,
2620+
newtargettaghash),
2621+
HASH_ENTER_NULL,
2622+
&found);
26242623
if (!newpredlock)
26252624
{
26262625
/* Out of shared memory. Undo what we've done so far. */
@@ -2856,12 +2855,12 @@ DropAllPredicateLocksFromTable(Relation relation, bool transfer)
28562855
newpredlocktag.myTarget=heaptarget;
28572856
newpredlocktag.myXact=oldXact;
28582857
newpredlock= (PREDICATELOCK*)
2859-
hash_search_with_hash_value
2860-
(PredicateLockHash,
2861-
&newpredlocktag,
2862-
PredicateLockHashCodeFromTargetHashCode(&newpredlocktag,
2863-
heaptargettaghash),
2864-
HASH_ENTER,&found);
2858+
hash_search_with_hash_value(PredicateLockHash,
2859+
&newpredlocktag,
2860+
PredicateLockHashCodeFromTargetHashCode(&newpredlocktag,
2861+
heaptargettaghash),
2862+
HASH_ENTER,
2863+
&found);
28652864
if (!found)
28662865
{
28672866
SHMQueueInsertBefore(&(heaptarget->predicateLocks),
@@ -4327,7 +4326,7 @@ FlagRWConflict(SERIALIZABLEXACT *reader, SERIALIZABLEXACT *writer)
43274326
*----------------------------------------------------------------------------
43284327
*/
43294328
staticvoid
4330-
OnConflict_CheckForSerializationFailure(SERIALIZABLEXACT*reader,
4329+
OnConflict_CheckForSerializationFailure(constSERIALIZABLEXACT*reader,
43314330
SERIALIZABLEXACT*writer)
43324331
{
43334332
boolfailure;

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp