1 /*-------------------------------------------------------------------------
4 * POSTGRES memory allocator definitions.
7 * Copyright (c) 1994, Regents of the University of California
9 * $Id: palloc.h,v 1.9 1999/05/25 16:14:56 momjian Exp $
11 *-------------------------------------------------------------------------
18 #ifdef PALLOC_IS_MALLOC
20 #define palloc(s) malloc(s)
21 #define pfree(p) free(p)
22 #define repalloc(p,s) realloc((p),(s))
24 #else /* ! PALLOC_IS_MALLOC */
27 * In the case we use memory contexts, use macro's for palloc() etc.
30 #include "utils/mcxt.h"
32 #define palloc(s) ((void *)MemoryContextAlloc(CurrentMemoryContext,(Size)(s)))
33 #define pfree(p) MemoryContextFree(CurrentMemoryContext,(Pointer)(p))
34 #define repalloc(p,s) ((void *)MemoryContextRealloc(CurrentMemoryContext,(Pointer)(p),(Size)(s)))
36 #endif /* PALLOC_IS_MALLOC */
38 /* like strdup except uses palloc */
39 extern char *pstrdup(char *pointer);