OSDN Git Service

rebuid:
[eos/hostdependX86MAC64.git] / util / X86MAC64 / include / postgresql / server / common / fe_memutils.h
1 /*
2  *      fe_memutils.h
3  *              memory management support for frontend code
4  *
5  *      Copyright (c) 2003-2014, PostgreSQL Global Development Group
6  *
7  *      src/include/common/fe_memutils.h
8  */
9 #ifndef FE_MEMUTILS_H
10 #define FE_MEMUTILS_H
11
12 /* "Safe" memory allocation functions --- these exit(1) on failure */
13 extern char *pg_strdup(const char *in);
14 extern void *pg_malloc(size_t size);
15 extern void *pg_malloc0(size_t size);
16 extern void *pg_realloc(void *pointer, size_t size);
17 extern void pg_free(void *pointer);
18
19 /* Equivalent functions, deliberately named the same as backend functions */
20 extern char *pstrdup(const char *in);
21 extern void *palloc(Size size);
22 extern void *palloc0(Size size);
23 extern void *repalloc(void *pointer, Size size);
24 extern void pfree(void *pointer);
25
26 /* sprintf into a palloc'd buffer --- these are in psprintf.c */
27 extern char *
28 psprintf(const char *fmt,...)
29 __attribute__((format(PG_PRINTF_ATTRIBUTE, 1, 2)));
30 extern size_t
31 pvsnprintf(char *buf, size_t len, const char *fmt, va_list args)
32 __attribute__((format(PG_PRINTF_ATTRIBUTE, 3, 0)));
33
34 #endif   /* FE_MEMUTILS_H */