Commit 74811c40 authored by Jeff Davis's avatar Jeff Davis

Rename variable in AllocSetContextCreate to be consistent.

Everywhere else in the file, "context" is of type MemoryContext and
"set" is of type AllocSet. AllocSetContextCreate uses a variable of
type AllocSet, so rename it from "context" to "set".
parent b419865a
...@@ -438,14 +438,14 @@ AllocSetContextCreate(MemoryContext parent, ...@@ -438,14 +438,14 @@ AllocSetContextCreate(MemoryContext parent,
Size initBlockSize, Size initBlockSize,
Size maxBlockSize) Size maxBlockSize)
{ {
AllocSet context; AllocSet set;
/* Do the type-independent part of context creation */ /* Do the type-independent part of context creation */
context = (AllocSet) MemoryContextCreate(T_AllocSetContext, set = (AllocSet) MemoryContextCreate(T_AllocSetContext,
sizeof(AllocSetContext), sizeof(AllocSetContext),
&AllocSetMethods, &AllocSetMethods,
parent, parent,
name); name);
/* /*
* Make sure alloc parameters are reasonable, and save them. * Make sure alloc parameters are reasonable, and save them.
...@@ -459,9 +459,9 @@ AllocSetContextCreate(MemoryContext parent, ...@@ -459,9 +459,9 @@ AllocSetContextCreate(MemoryContext parent,
if (maxBlockSize < initBlockSize) if (maxBlockSize < initBlockSize)
maxBlockSize = initBlockSize; maxBlockSize = initBlockSize;
Assert(AllocHugeSizeIsValid(maxBlockSize)); /* must be safe to double */ Assert(AllocHugeSizeIsValid(maxBlockSize)); /* must be safe to double */
context->initBlockSize = initBlockSize; set->initBlockSize = initBlockSize;
context->maxBlockSize = maxBlockSize; set->maxBlockSize = maxBlockSize;
context->nextBlockSize = initBlockSize; set->nextBlockSize = initBlockSize;
/* /*
* Compute the allocation chunk size limit for this context. It can't be * Compute the allocation chunk size limit for this context. It can't be
...@@ -477,10 +477,10 @@ AllocSetContextCreate(MemoryContext parent, ...@@ -477,10 +477,10 @@ AllocSetContextCreate(MemoryContext parent,
* and actually-allocated sizes of any chunk must be on the same side of * and actually-allocated sizes of any chunk must be on the same side of
* the limit, else we get confused about whether the chunk is "big". * the limit, else we get confused about whether the chunk is "big".
*/ */
context->allocChunkLimit = ALLOC_CHUNK_LIMIT; set->allocChunkLimit = ALLOC_CHUNK_LIMIT;
while ((Size) (context->allocChunkLimit + ALLOC_CHUNKHDRSZ) > while ((Size) (set->allocChunkLimit + ALLOC_CHUNKHDRSZ) >
(Size) ((maxBlockSize - ALLOC_BLOCKHDRSZ) / ALLOC_CHUNK_FRACTION)) (Size) ((maxBlockSize - ALLOC_BLOCKHDRSZ) / ALLOC_CHUNK_FRACTION))
context->allocChunkLimit >>= 1; set->allocChunkLimit >>= 1;
/* /*
* Grab always-allocated space, if requested * Grab always-allocated space, if requested
...@@ -500,20 +500,20 @@ AllocSetContextCreate(MemoryContext parent, ...@@ -500,20 +500,20 @@ AllocSetContextCreate(MemoryContext parent,
errdetail("Failed while creating memory context \"%s\".", errdetail("Failed while creating memory context \"%s\".",
name))); name)));
} }
block->aset = context; block->aset = set;
block->freeptr = ((char *) block) + ALLOC_BLOCKHDRSZ; block->freeptr = ((char *) block) + ALLOC_BLOCKHDRSZ;
block->endptr = ((char *) block) + blksize; block->endptr = ((char *) block) + blksize;
block->next = context->blocks; block->next = set->blocks;
context->blocks = block; set->blocks = block;
/* Mark block as not to be released at reset time */ /* Mark block as not to be released at reset time */
context->keeper = block; set->keeper = block;
/* Mark unallocated space NOACCESS; leave the block header alone. */ /* Mark unallocated space NOACCESS; leave the block header alone. */
VALGRIND_MAKE_MEM_NOACCESS(block->freeptr, VALGRIND_MAKE_MEM_NOACCESS(block->freeptr,
blksize - ALLOC_BLOCKHDRSZ); blksize - ALLOC_BLOCKHDRSZ);
} }
return (MemoryContext) context; return (MemoryContext) set;
} }
/* /*
......
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