diff options
| author | Jan Wieck <JanWieck@Yahoo.com> | 1999-02-06 16:50:34 +0000 |
|---|---|---|
| committer | Jan Wieck <JanWieck@Yahoo.com> | 1999-02-06 16:50:34 +0000 |
| commit | ead64f317be6eae7cdff9074659f8140aea3c4d5 (patch) | |
| tree | f7fe63cf1348da3e4faec9e2dde2f87192ae257a /src/include/utils/palloc.h | |
| parent | 7d2b3874aa0a759f69c0eaa0e140353418fc270e (diff) | |
| download | postgresql-ead64f317be6eae7cdff9074659f8140aea3c4d5.tar.gz | |
New alloc set code using a memory block pool for small allocations.
Jan
Diffstat (limited to 'src/include/utils/palloc.h')
| -rw-r--r-- | src/include/utils/palloc.h | 26 |
1 files changed, 21 insertions, 5 deletions
diff --git a/src/include/utils/palloc.h b/src/include/utils/palloc.h index 2c969df174..05fccc81a3 100644 --- a/src/include/utils/palloc.h +++ b/src/include/utils/palloc.h @@ -6,18 +6,34 @@ * * Copyright (c) 1994, Regents of the University of California * - * $Id: palloc.h,v 1.6 1998/09/01 04:39:24 momjian Exp $ + * $Id: palloc.h,v 1.7 1999/02/06 16:50:34 wieck Exp $ * *------------------------------------------------------------------------- */ #ifndef PALLOC_H #define PALLOC_H -#include <c.h> +#include "c.h" -extern void *palloc(Size size); -extern void pfree(void *pointer); -extern void *repalloc(void *pointer, Size size); +#ifdef PALLOC_IS_MALLOC + +# define palloc(s) malloc(s) +# define pfree(p) free(p) +# define repalloc(p,s) realloc((p),(s)) + +#else /* ! PALLOC_IS_MALLOC */ + +/* ---------- + * In the case we use memory contexts, use macro's for palloc() etc. + * ---------- + */ +# include "utils/mcxt.h" + +# define palloc(s) ((void *)MemoryContextAlloc(CurrentMemoryContext,(Size)(s))) +# define pfree(p) MemoryContextFree(CurrentMemoryContext,(Pointer)(p)) +# define repalloc(p,s) ((void *)MemoryContextRealloc(CurrentMemoryContext,(Pointer)(p),(Size)(s))) + +#endif /* PALLOC_IS_MALLOC */ /* like strdup except uses palloc */ extern char *pstrdup(char *pointer); |
