diff options
Diffstat (limited to 'src/include/utils/palloc.h')
-rw-r--r-- | src/include/utils/palloc.h | 25 |
1 files changed, 10 insertions, 15 deletions
diff --git a/src/include/utils/palloc.h b/src/include/utils/palloc.h index ff440f7c89c..61d03351d13 100644 --- a/src/include/utils/palloc.h +++ b/src/include/utils/palloc.h @@ -35,12 +35,10 @@ */ typedef struct MemoryContextData *MemoryContext; -#ifndef FRONTEND - /* * CurrentMemoryContext is the default allocation context for palloc(). - * We declare it here so that palloc() can be a macro. Avoid accessing it - * directly! Instead, use MemoryContextSwitchTo() to change the setting. + * Avoid accessing it directly! Instead, use MemoryContextSwitchTo() + * to change the setting. */ extern PGDLLIMPORT MemoryContext CurrentMemoryContext; @@ -51,9 +49,10 @@ extern void *MemoryContextAlloc(MemoryContext context, Size size); extern void *MemoryContextAllocZero(MemoryContext context, Size size); extern void *MemoryContextAllocZeroAligned(MemoryContext context, Size size); -/* Higher-limit allocators. */ -extern void *MemoryContextAllocHuge(MemoryContext context, Size size); -extern void *repalloc_huge(void *pointer, Size size); +extern void *palloc(Size size); +extern void *palloc0(Size size); +extern void *repalloc(void *pointer, Size size); +extern void pfree(void *pointer); /* * The result of palloc() is always word-aligned, so we can skip testing @@ -68,6 +67,10 @@ extern void *repalloc_huge(void *pointer, Size size); MemoryContextAllocZeroAligned(CurrentMemoryContext, sz) : \ MemoryContextAllocZero(CurrentMemoryContext, sz) ) +/* Higher-limit allocators. */ +extern void *MemoryContextAllocHuge(MemoryContext context, Size size); +extern void *repalloc_huge(void *pointer, Size size); + /* * MemoryContextSwitchTo can't be a macro in standard C compilers. * But we can make it an inline function if the compiler supports it. @@ -93,17 +96,9 @@ MemoryContextSwitchTo(MemoryContext context) * allocated in a context, not with malloc(). */ extern char *MemoryContextStrdup(MemoryContext context, const char *string); -#endif /* !FRONTEND */ - extern char *pstrdup(const char *in); extern char *pnstrdup(const char *in, Size len); -/* basic memory allocation functions */ -extern void *palloc(Size size); -extern void *palloc0(Size size); -extern void pfree(void *pointer); -extern void *repalloc(void *pointer, Size size); - /* sprintf into a palloc'd buffer --- these are in psprintf.c */ extern char *psprintf(const char *fmt,...) __attribute__((format(PG_PRINTF_ATTRIBUTE, 1, 2))); |