1996-08-27 21:59:28 -04:00
|
|
|
/*-------------------------------------------------------------------------
|
|
|
|
|
*
|
1999-02-13 18:22:53 -05:00
|
|
|
* palloc.h
|
1997-09-07 01:04:48 -04:00
|
|
|
* POSTGRES memory allocator definitions.
|
1996-08-27 21:59:28 -04:00
|
|
|
*
|
|
|
|
|
*
|
2000-01-26 00:58:53 -05:00
|
|
|
* Portions Copyright (c) 1996-2000, PostgreSQL, Inc
|
|
|
|
|
* Portions Copyright (c) 1994, Regents of the University of California
|
1996-08-27 21:59:28 -04:00
|
|
|
*
|
2000-01-26 00:58:53 -05:00
|
|
|
* $Id: palloc.h,v 1.12 2000/01/26 05:58:38 momjian Exp $
|
1996-08-27 21:59:28 -04:00
|
|
|
*
|
|
|
|
|
*-------------------------------------------------------------------------
|
|
|
|
|
*/
|
1997-09-07 01:04:48 -04:00
|
|
|
#ifndef PALLOC_H
|
1996-08-27 21:59:28 -04:00
|
|
|
#define PALLOC_H
|
|
|
|
|
|
1999-02-06 11:50:34 -05:00
|
|
|
#ifdef PALLOC_IS_MALLOC
|
|
|
|
|
|
1999-05-25 12:15:34 -04:00
|
|
|
#define palloc(s) malloc(s)
|
|
|
|
|
#define pfree(p) free(p)
|
|
|
|
|
#define repalloc(p,s) realloc((p),(s))
|
1999-02-06 11:50:34 -05:00
|
|
|
|
1999-05-25 12:15:34 -04:00
|
|
|
#else /* ! PALLOC_IS_MALLOC */
|
1999-02-06 11:50:34 -05:00
|
|
|
|
|
|
|
|
/* ----------
|
|
|
|
|
* In the case we use memory contexts, use macro's for palloc() etc.
|
|
|
|
|
* ----------
|
|
|
|
|
*/
|
1999-05-25 12:15:34 -04:00
|
|
|
#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)))
|
1999-02-06 11:50:34 -05:00
|
|
|
|
1999-05-25 12:15:34 -04:00
|
|
|
#endif /* PALLOC_IS_MALLOC */
|
1996-08-27 21:59:28 -04:00
|
|
|
|
|
|
|
|
/* like strdup except uses palloc */
|
2000-01-13 13:26:18 -05:00
|
|
|
extern char *pstrdup(const char *pointer);
|
1996-08-27 21:59:28 -04:00
|
|
|
|
1998-09-01 00:40:42 -04:00
|
|
|
#endif /* PALLOC_H */
|