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:
@@ -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;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user