Skip to content

Commit bbca776

Browse files
committed
Rename MemoryContextCopySetIdentifier() for clarity
MemoryContextCopySetIdentifier -> MemoryContextCopyAndSetIdentifier Discussion: https://www.postgresql.org/message-id/6421.1522194949@sss.pgh.pa.us
1 parent cfbecf8 commit bbca776

File tree

6 files changed

+10
-10
lines changed

6 files changed

+10
-10
lines changed

src/backend/catalog/partition.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -528,7 +528,7 @@ RelationBuildPartitionDesc(Relation rel)
528528
rel->rd_pdcxt = AllocSetContextCreate(CacheMemoryContext,
529529
"partition descriptor",
530530
ALLOCSET_DEFAULT_SIZES);
531-
MemoryContextCopySetIdentifier(rel->rd_pdcxt, RelationGetRelationName(rel));
531+
MemoryContextCopyAndSetIdentifier(rel->rd_pdcxt, RelationGetRelationName(rel));
532532

533533
oldcxt = MemoryContextSwitchTo(rel->rd_pdcxt);
534534

src/backend/commands/policy.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -214,7 +214,7 @@ RelationBuildRowSecurity(Relation relation)
214214
SysScanDesc sscan;
215215
HeapTuple tuple;
216216

217-
MemoryContextCopySetIdentifier(rscxt,
217+
MemoryContextCopyAndSetIdentifier(rscxt,
218218
RelationGetRelationName(relation));
219219

220220
rsdesc = MemoryContextAllocZero(rscxt, sizeof(RowSecurityDesc));

src/backend/utils/cache/plancache.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -952,7 +952,7 @@ BuildCachedPlan(CachedPlanSource *plansource, List *qlist,
952952
plan_context = AllocSetContextCreate(CurrentMemoryContext,
953953
"CachedPlan",
954954
ALLOCSET_START_SMALL_SIZES);
955-
MemoryContextCopySetIdentifier(plan_context, plansource->query_string);
955+
MemoryContextCopyAndSetIdentifier(plan_context, plansource->query_string);
956956

957957
/*
958958
* Copy plan into the new context.

src/backend/utils/cache/relcache.c

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -741,7 +741,7 @@ RelationBuildRuleLock(Relation relation)
741741
"relation rules",
742742
ALLOCSET_SMALL_SIZES);
743743
relation->rd_rulescxt = rulescxt;
744-
MemoryContextCopySetIdentifier(rulescxt,
744+
MemoryContextCopyAndSetIdentifier(rulescxt,
745745
RelationGetRelationName(relation));
746746

747747
/*
@@ -918,7 +918,7 @@ RelationBuildPartitionKey(Relation relation)
918918
partkeycxt = AllocSetContextCreate(CurTransactionContext,
919919
"partition key",
920920
ALLOCSET_SMALL_SIZES);
921-
MemoryContextCopySetIdentifier(partkeycxt,
921+
MemoryContextCopyAndSetIdentifier(partkeycxt,
922922
RelationGetRelationName(relation));
923923

924924
key = (PartitionKey) MemoryContextAllocZero(partkeycxt,
@@ -1601,7 +1601,7 @@ RelationInitIndexAccessInfo(Relation relation)
16011601
"index info",
16021602
ALLOCSET_SMALL_SIZES);
16031603
relation->rd_indexcxt = indexcxt;
1604-
MemoryContextCopySetIdentifier(indexcxt,
1604+
MemoryContextCopyAndSetIdentifier(indexcxt,
16051605
RelationGetRelationName(relation));
16061606

16071607
/*
@@ -5668,7 +5668,7 @@ load_relcache_init_file(bool shared)
56685668
"index info",
56695669
ALLOCSET_SMALL_SIZES);
56705670
rel->rd_indexcxt = indexcxt;
5671-
MemoryContextCopySetIdentifier(indexcxt,
5671+
MemoryContextCopyAndSetIdentifier(indexcxt,
56725672
RelationGetRelationName(rel));
56735673

56745674
/*

src/backend/utils/cache/ts_cache.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -297,7 +297,7 @@ lookup_ts_dictionary_cache(Oid dictId)
297297
saveCtx = AllocSetContextCreate(CacheMemoryContext,
298298
"TS dictionary",
299299
ALLOCSET_SMALL_SIZES);
300-
MemoryContextCopySetIdentifier(saveCtx, NameStr(dict->dictname));
300+
MemoryContextCopyAndSetIdentifier(saveCtx, NameStr(dict->dictname));
301301
}
302302
else
303303
{
@@ -306,7 +306,7 @@ lookup_ts_dictionary_cache(Oid dictId)
306306
/* Don't let context's ident pointer dangle while we reset it */
307307
MemoryContextSetIdentifier(saveCtx, NULL);
308308
MemoryContextReset(saveCtx);
309-
MemoryContextCopySetIdentifier(saveCtx, NameStr(dict->dictname));
309+
MemoryContextCopyAndSetIdentifier(saveCtx, NameStr(dict->dictname));
310310
}
311311

312312
MemSet(entry, 0, sizeof(TSDictionaryCacheEntry));

src/include/utils/memutils.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -93,7 +93,7 @@ extern void MemoryContextCheck(MemoryContext context);
9393
extern bool MemoryContextContains(MemoryContext context, void *pointer);
9494

9595
/* Handy macro for copying and assigning context ID ... but note double eval */
96-
#define MemoryContextCopySetIdentifier(cxt, id) \
96+
#define MemoryContextCopyAndSetIdentifier(cxt, id) \
9797
MemoryContextSetIdentifier(cxt, MemoryContextStrdup(cxt, id))
9898

9999
/*

0 commit comments

Comments
 (0)