1
0
mirror of https://github.com/postgres/postgres.git synced 2025-08-22 21:53:06 +03:00

Oops, back out newNode changes. We are not ready for that yet.

This commit is contained in:
Bruce Momjian
2002-10-11 04:16:44 +00:00
parent 6a7bb0afbc
commit 2177b6b635
4 changed files with 20 additions and 49 deletions

View File

@@ -9,7 +9,7 @@
*
*
* IDENTIFICATION
* $Header: /cvsroot/pgsql/src/backend/nodes/nodes.c,v 1.16 2002/10/11 04:12:14 momjian Exp $
* $Header: /cvsroot/pgsql/src/backend/nodes/nodes.c,v 1.17 2002/10/11 04:16:44 momjian Exp $
*
* HISTORY
* Andrew Yu Oct 20, 1994 file creation
@@ -28,5 +28,15 @@
* macro makeNode. eg. to create a Resdom node, use makeNode(Resdom)
*
*/
Node *newNodeMacroHolder;
Node *
newNode(Size size, NodeTag tag)
{
Node *newNode;
Assert(size >= sizeof(Node)); /* need the tag, at least */
newNode = (Node *) palloc(size);
MemSet((char *) newNode, 0, size);
newNode->type = tag;
return newNode;
}

View File

@@ -14,7 +14,7 @@
*
*
* IDENTIFICATION
* $Header: /cvsroot/pgsql/src/backend/utils/mmgr/mcxt.c,v 1.33 2002/10/11 04:12:14 momjian Exp $
* $Header: /cvsroot/pgsql/src/backend/utils/mmgr/mcxt.c,v 1.34 2002/10/11 04:16:44 momjian Exp $
*
*-------------------------------------------------------------------------
*/
@@ -452,29 +452,6 @@ MemoryContextAlloc(MemoryContext context, Size size)
return (*context->methods->alloc) (context, size);
}
/*
* MemoryContextAllocZero
* 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)
{
void *ret;
AssertArg(MemoryContextIsValid(context));
if (!AllocSizeIsValid(size))
elog(ERROR, "MemoryContextAllocZero: invalid request size %lu",
(unsigned long) size);
ret = (*context->methods->alloc) (context, size);
MemSet(ret, 0, size);
return ret;
}
/*
* pfree
* Release an allocated chunk.