OSDN Git Service

pgindent run over code.
[pg-rex/syncrep.git] / src / include / utils / palloc.h
1 /*-------------------------------------------------------------------------
2  *
3  * palloc.h
4  *        POSTGRES memory allocator definitions.
5  *
6  *
7  * Copyright (c) 1994, Regents of the University of California
8  *
9  * $Id: palloc.h,v 1.9 1999/05/25 16:14:56 momjian Exp $
10  *
11  *-------------------------------------------------------------------------
12  */
13 #ifndef PALLOC_H
14 #define PALLOC_H
15
16 #include "c.h"
17
18 #ifdef PALLOC_IS_MALLOC
19
20 #define palloc(s)         malloc(s)
21 #define pfree(p)          free(p)
22 #define repalloc(p,s) realloc((p),(s))
23
24 #else                                                   /* ! PALLOC_IS_MALLOC */
25
26 /* ----------
27  * In the case we use memory contexts, use macro's for palloc() etc.
28  * ----------
29  */
30 #include "utils/mcxt.h"
31
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)))
35
36 #endif   /* PALLOC_IS_MALLOC */
37
38 /* like strdup except uses palloc */
39 extern char *pstrdup(char *pointer);
40
41 #endif   /* PALLOC_H */