blob: f78e78fcc5967e06ae052e55fbda62029ad0185e (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
|
/*-------------------------------------------------------------------------
*
* gen_alloc.h
*
*
* Portions Copyright (c) 1996-2010, PostgreSQL Global Development Group
* Portions Copyright (c) 1994, Regents of the University of California
* Portions Copyright (c) 2010-2012 Postgres-XC Development Group
*
* src/include/gen_alloc.h
*
*-------------------------------------------------------------------------
*/
#ifndef GEN_ALLOC_H
#define GEN_ALLOC_H
/*
* Common memory allocation binary interface both for Postgres and GTM processes.
* Especially needed by gtm_serialize.c and gtm_serialize_debug.c
*/
typedef struct Gen_Alloc
{
void * (* alloc) (void *, size_t);
void * (* alloc0) (void *, size_t);
void * (* realloc) (void *, size_t);
void (* free) (void *);
void * (* current_memcontext) (void);
void * (* allocTop) (size_t);
} Gen_Alloc;
extern Gen_Alloc genAlloc_class;
#define genAlloc(x) genAlloc_class.alloc(genAlloc_class.current_memcontext(), x)
#define genRealloc(x, y) genAlloc_class.realloc(x, y)
#define genFree(x) genAlloc_class.free(x)
#define genAlloc0(x) genAlloc_class.alloc0(genAlloc_class.current_memcontext(), x)
#define genAllocTop(x) genAlloc_class.allocTop(x)
#endif /* GEN_ALLOC_H */
|