Commit bbca7762 authored by Peter Eisentraut's avatar Peter Eisentraut

Rename MemoryContextCopySetIdentifier() for clarity

MemoryContextCopySetIdentifier -> MemoryContextCopyAndSetIdentifier

Discussion: https://www.postgresql.org/message-id/6421.1522194949@sss.pgh.pa.us
parent cfbecf81
...@@ -528,7 +528,7 @@ RelationBuildPartitionDesc(Relation rel) ...@@ -528,7 +528,7 @@ RelationBuildPartitionDesc(Relation rel)
rel->rd_pdcxt = AllocSetContextCreate(CacheMemoryContext, rel->rd_pdcxt = AllocSetContextCreate(CacheMemoryContext,
"partition descriptor", "partition descriptor",
ALLOCSET_DEFAULT_SIZES); ALLOCSET_DEFAULT_SIZES);
MemoryContextCopySetIdentifier(rel->rd_pdcxt, RelationGetRelationName(rel)); MemoryContextCopyAndSetIdentifier(rel->rd_pdcxt, RelationGetRelationName(rel));
oldcxt = MemoryContextSwitchTo(rel->rd_pdcxt); oldcxt = MemoryContextSwitchTo(rel->rd_pdcxt);
......
...@@ -214,7 +214,7 @@ RelationBuildRowSecurity(Relation relation) ...@@ -214,7 +214,7 @@ RelationBuildRowSecurity(Relation relation)
SysScanDesc sscan; SysScanDesc sscan;
HeapTuple tuple; HeapTuple tuple;
MemoryContextCopySetIdentifier(rscxt, MemoryContextCopyAndSetIdentifier(rscxt,
RelationGetRelationName(relation)); RelationGetRelationName(relation));
rsdesc = MemoryContextAllocZero(rscxt, sizeof(RowSecurityDesc)); rsdesc = MemoryContextAllocZero(rscxt, sizeof(RowSecurityDesc));
......
...@@ -952,7 +952,7 @@ BuildCachedPlan(CachedPlanSource *plansource, List *qlist, ...@@ -952,7 +952,7 @@ BuildCachedPlan(CachedPlanSource *plansource, List *qlist,
plan_context = AllocSetContextCreate(CurrentMemoryContext, plan_context = AllocSetContextCreate(CurrentMemoryContext,
"CachedPlan", "CachedPlan",
ALLOCSET_START_SMALL_SIZES); ALLOCSET_START_SMALL_SIZES);
MemoryContextCopySetIdentifier(plan_context, plansource->query_string); MemoryContextCopyAndSetIdentifier(plan_context, plansource->query_string);
/* /*
* Copy plan into the new context. * Copy plan into the new context.
......
...@@ -741,7 +741,7 @@ RelationBuildRuleLock(Relation relation) ...@@ -741,7 +741,7 @@ RelationBuildRuleLock(Relation relation)
"relation rules", "relation rules",
ALLOCSET_SMALL_SIZES); ALLOCSET_SMALL_SIZES);
relation->rd_rulescxt = rulescxt; relation->rd_rulescxt = rulescxt;
MemoryContextCopySetIdentifier(rulescxt, MemoryContextCopyAndSetIdentifier(rulescxt,
RelationGetRelationName(relation)); RelationGetRelationName(relation));
/* /*
...@@ -918,7 +918,7 @@ RelationBuildPartitionKey(Relation relation) ...@@ -918,7 +918,7 @@ RelationBuildPartitionKey(Relation relation)
partkeycxt = AllocSetContextCreate(CurTransactionContext, partkeycxt = AllocSetContextCreate(CurTransactionContext,
"partition key", "partition key",
ALLOCSET_SMALL_SIZES); ALLOCSET_SMALL_SIZES);
MemoryContextCopySetIdentifier(partkeycxt, MemoryContextCopyAndSetIdentifier(partkeycxt,
RelationGetRelationName(relation)); RelationGetRelationName(relation));
key = (PartitionKey) MemoryContextAllocZero(partkeycxt, key = (PartitionKey) MemoryContextAllocZero(partkeycxt,
...@@ -1601,7 +1601,7 @@ RelationInitIndexAccessInfo(Relation relation) ...@@ -1601,7 +1601,7 @@ RelationInitIndexAccessInfo(Relation relation)
"index info", "index info",
ALLOCSET_SMALL_SIZES); ALLOCSET_SMALL_SIZES);
relation->rd_indexcxt = indexcxt; relation->rd_indexcxt = indexcxt;
MemoryContextCopySetIdentifier(indexcxt, MemoryContextCopyAndSetIdentifier(indexcxt,
RelationGetRelationName(relation)); RelationGetRelationName(relation));
/* /*
...@@ -5668,7 +5668,7 @@ load_relcache_init_file(bool shared) ...@@ -5668,7 +5668,7 @@ load_relcache_init_file(bool shared)
"index info", "index info",
ALLOCSET_SMALL_SIZES); ALLOCSET_SMALL_SIZES);
rel->rd_indexcxt = indexcxt; rel->rd_indexcxt = indexcxt;
MemoryContextCopySetIdentifier(indexcxt, MemoryContextCopyAndSetIdentifier(indexcxt,
RelationGetRelationName(rel)); RelationGetRelationName(rel));
/* /*
......
...@@ -297,7 +297,7 @@ lookup_ts_dictionary_cache(Oid dictId) ...@@ -297,7 +297,7 @@ lookup_ts_dictionary_cache(Oid dictId)
saveCtx = AllocSetContextCreate(CacheMemoryContext, saveCtx = AllocSetContextCreate(CacheMemoryContext,
"TS dictionary", "TS dictionary",
ALLOCSET_SMALL_SIZES); ALLOCSET_SMALL_SIZES);
MemoryContextCopySetIdentifier(saveCtx, NameStr(dict->dictname)); MemoryContextCopyAndSetIdentifier(saveCtx, NameStr(dict->dictname));
} }
else else
{ {
...@@ -306,7 +306,7 @@ lookup_ts_dictionary_cache(Oid dictId) ...@@ -306,7 +306,7 @@ lookup_ts_dictionary_cache(Oid dictId)
/* Don't let context's ident pointer dangle while we reset it */ /* Don't let context's ident pointer dangle while we reset it */
MemoryContextSetIdentifier(saveCtx, NULL); MemoryContextSetIdentifier(saveCtx, NULL);
MemoryContextReset(saveCtx); MemoryContextReset(saveCtx);
MemoryContextCopySetIdentifier(saveCtx, NameStr(dict->dictname)); MemoryContextCopyAndSetIdentifier(saveCtx, NameStr(dict->dictname));
} }
MemSet(entry, 0, sizeof(TSDictionaryCacheEntry)); MemSet(entry, 0, sizeof(TSDictionaryCacheEntry));
......
...@@ -93,7 +93,7 @@ extern void MemoryContextCheck(MemoryContext context); ...@@ -93,7 +93,7 @@ extern void MemoryContextCheck(MemoryContext context);
extern bool MemoryContextContains(MemoryContext context, void *pointer); extern bool MemoryContextContains(MemoryContext context, void *pointer);
/* Handy macro for copying and assigning context ID ... but note double eval */ /* Handy macro for copying and assigning context ID ... but note double eval */
#define MemoryContextCopySetIdentifier(cxt, id) \ #define MemoryContextCopyAndSetIdentifier(cxt, id) \
MemoryContextSetIdentifier(cxt, MemoryContextStrdup(cxt, id)) MemoryContextSetIdentifier(cxt, MemoryContextStrdup(cxt, id))
/* /*
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment