1
0
mirror of https://github.com/postgres/postgres.git synced 2025-11-13 16:22:44 +03:00

Split MemSet into three parts to constant comparisons can be optimized

away by the compiler;  used by palloc0.
This commit is contained in:
Bruce Momjian
2002-11-13 00:37:06 +00:00
parent 266c3679f7
commit aaa3a0caa6
3 changed files with 39 additions and 25 deletions

View File

@@ -14,7 +14,7 @@
*
*
* IDENTIFICATION
* $Header: /cvsroot/pgsql/src/backend/utils/mmgr/mcxt.c,v 1.35 2002/11/10 02:17:25 momjian Exp $
* $Header: /cvsroot/pgsql/src/backend/utils/mmgr/mcxt.c,v 1.36 2002/11/13 00:37:06 momjian Exp $
*
*-------------------------------------------------------------------------
*/
@@ -453,14 +453,14 @@ MemoryContextAlloc(MemoryContext context, Size size)
}
/*
* MemoryContextAllocZero
* MemoryContextAllocPalloc0
* Like MemoryContextAlloc, but clears allocated memory
*
* We could just call MemoryContextAlloc then clear the memory, but this
* function is called too many times, so we have a separate version.
*/
void *
MemoryContextAllocZero(MemoryContext context, Size size)
MemoryContextAllocPalloc0(MemoryContext context, Size size)
{
void *ret;
@@ -471,7 +471,7 @@ MemoryContextAllocZero(MemoryContext context, Size size)
(unsigned long) size);
ret = (*context->methods->alloc) (context, size);
MemSet(ret, 0, size);
MemSetLoop(ret, 0, size);
return ret;
}