Rename MemoryContextCopySetIdentifier() for clarity
authorPeter Eisentraut <peter_e@gmx.net>
Fri, 6 Apr 2018 16:10:00 +0000 (12:10 -0400)
committerPeter Eisentraut <peter_e@gmx.net>
Fri, 6 Apr 2018 16:37:54 +0000 (12:37 -0400)
MemoryContextCopySetIdentifier -> MemoryContextCopyAndSetIdentifier

Discussion: https://www.postgresql.org/message-id/6421.1522194949@sss.pgh.pa.us

src/backend/catalog/partition.c
src/backend/commands/policy.c
src/backend/utils/cache/plancache.c
src/backend/utils/cache/relcache.c
src/backend/utils/cache/ts_cache.c
src/include/utils/memutils.h

index 39ee773d93459305dcbc30764a378bd5729bff18..275c52c4c3a88cacfce90bf792b7777e0c997fa1 100644 (file)
@@ -528,7 +528,7 @@ RelationBuildPartitionDesc(Relation rel)
    rel->rd_pdcxt = AllocSetContextCreate(CacheMemoryContext,
                                          "partition descriptor",
                                          ALLOCSET_DEFAULT_SIZES);
-   MemoryContextCopySetIdentifier(rel->rd_pdcxt, RelationGetRelationName(rel));
+   MemoryContextCopyAndSetIdentifier(rel->rd_pdcxt, RelationGetRelationName(rel));
 
    oldcxt = MemoryContextSwitchTo(rel->rd_pdcxt);
 
index 00841b3b8a0cdb3808ad31b9f3e65d409390804d..b2b845613d5c812eaa333d50d1f9b1f8412a7c26 100644 (file)
@@ -214,7 +214,7 @@ RelationBuildRowSecurity(Relation relation)
        SysScanDesc sscan;
        HeapTuple   tuple;
 
-       MemoryContextCopySetIdentifier(rscxt,
+       MemoryContextCopyAndSetIdentifier(rscxt,
                                       RelationGetRelationName(relation));
 
        rsdesc = MemoryContextAllocZero(rscxt, sizeof(RowSecurityDesc));
index 85bb7b914a049256dd4b0cc602ea2f91eba68cd0..0ad3e3c736664b0e0a68c4ab8d649af919bb2b2f 100644 (file)
@@ -952,7 +952,7 @@ BuildCachedPlan(CachedPlanSource *plansource, List *qlist,
        plan_context = AllocSetContextCreate(CurrentMemoryContext,
                                             "CachedPlan",
                                             ALLOCSET_START_SMALL_SIZES);
-       MemoryContextCopySetIdentifier(plan_context, plansource->query_string);
+       MemoryContextCopyAndSetIdentifier(plan_context, plansource->query_string);
 
        /*
         * Copy plan into the new context.
index 69a2114a104f4897778818e7529627456f35fb01..b6ed06d5b3c60202042af153cabf54de1a0f86dc 100644 (file)
@@ -741,7 +741,7 @@ RelationBuildRuleLock(Relation relation)
                                     "relation rules",
                                     ALLOCSET_SMALL_SIZES);
    relation->rd_rulescxt = rulescxt;
-   MemoryContextCopySetIdentifier(rulescxt,
+   MemoryContextCopyAndSetIdentifier(rulescxt,
                                   RelationGetRelationName(relation));
 
    /*
@@ -918,7 +918,7 @@ RelationBuildPartitionKey(Relation relation)
    partkeycxt = AllocSetContextCreate(CurTransactionContext,
                                       "partition key",
                                       ALLOCSET_SMALL_SIZES);
-   MemoryContextCopySetIdentifier(partkeycxt,
+   MemoryContextCopyAndSetIdentifier(partkeycxt,
                                   RelationGetRelationName(relation));
 
    key = (PartitionKey) MemoryContextAllocZero(partkeycxt,
@@ -1601,7 +1601,7 @@ RelationInitIndexAccessInfo(Relation relation)
                                     "index info",
                                     ALLOCSET_SMALL_SIZES);
    relation->rd_indexcxt = indexcxt;
-   MemoryContextCopySetIdentifier(indexcxt,
+   MemoryContextCopyAndSetIdentifier(indexcxt,
                                   RelationGetRelationName(relation));
 
    /*
@@ -5668,7 +5668,7 @@ load_relcache_init_file(bool shared)
                                             "index info",
                                             ALLOCSET_SMALL_SIZES);
            rel->rd_indexcxt = indexcxt;
-           MemoryContextCopySetIdentifier(indexcxt,
+           MemoryContextCopyAndSetIdentifier(indexcxt,
                                           RelationGetRelationName(rel));
 
            /*
index 97347780d3b79e5aae93283367bea44fbe6885fa..f11cba4ccedbe8db1e234fc4a067225137461aa3 100644 (file)
@@ -297,7 +297,7 @@ lookup_ts_dictionary_cache(Oid dictId)
            saveCtx = AllocSetContextCreate(CacheMemoryContext,
                                            "TS dictionary",
                                            ALLOCSET_SMALL_SIZES);
-           MemoryContextCopySetIdentifier(saveCtx, NameStr(dict->dictname));
+           MemoryContextCopyAndSetIdentifier(saveCtx, NameStr(dict->dictname));
        }
        else
        {
@@ -306,7 +306,7 @@ lookup_ts_dictionary_cache(Oid dictId)
            /* Don't let context's ident pointer dangle while we reset it */
            MemoryContextSetIdentifier(saveCtx, NULL);
            MemoryContextReset(saveCtx);
-           MemoryContextCopySetIdentifier(saveCtx, NameStr(dict->dictname));
+           MemoryContextCopyAndSetIdentifier(saveCtx, NameStr(dict->dictname));
        }
 
        MemSet(entry, 0, sizeof(TSDictionaryCacheEntry));
index 4f2ca26caf03c5169f3db3fd9b570c367849b7bb..bc5757681ba2e7912c9cbb4597a35f2b18f07e6d 100644 (file)
@@ -93,7 +93,7 @@ extern void MemoryContextCheck(MemoryContext context);
 extern bool MemoryContextContains(MemoryContext context, void *pointer);
 
 /* 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))
 
 /*