diff options
Diffstat (limited to 'src/include/utils/palloc.h')
-rw-r--r-- | src/include/utils/palloc.h | 30 |
1 files changed, 8 insertions, 22 deletions
diff --git a/src/include/utils/palloc.h b/src/include/utils/palloc.h index d86558e417f..7fc7ccc3b52 100644 --- a/src/include/utils/palloc.h +++ b/src/include/utils/palloc.h @@ -28,6 +28,8 @@ #ifndef PALLOC_H #define PALLOC_H +#ifndef FRONTEND + /* * Type MemoryContextData is declared in nodes/memnodes.h. Most users * of memory allocation should just treat it as an abstract type, so we @@ -49,10 +51,6 @@ extern void *MemoryContextAlloc(MemoryContext context, Size size); extern void *MemoryContextAllocZero(MemoryContext context, Size size); extern void *MemoryContextAllocZeroAligned(MemoryContext context, Size size); -#define palloc(sz) MemoryContextAlloc(CurrentMemoryContext, (sz)) - -#define palloc0(sz) MemoryContextAllocZero(CurrentMemoryContext, (sz)) - /* * The result of palloc() is always word-aligned, so we can skip testing * alignment of the pointer when deciding which MemSet variant to use. @@ -66,20 +64,11 @@ extern void *MemoryContextAllocZeroAligned(MemoryContext context, Size size); MemoryContextAllocZeroAligned(CurrentMemoryContext, sz) : \ MemoryContextAllocZero(CurrentMemoryContext, sz) ) -extern void pfree(void *pointer); - -extern void *repalloc(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. * See STATIC_IF_INLINE in c.h. - * - * This file has to be includable by some non-backend code such as - * pg_resetxlog, so don't expose the CurrentMemoryContext reference - * if FRONTEND is defined. */ -#ifndef FRONTEND #ifndef PG_USE_INLINE extern MemoryContext MemoryContextSwitchTo(MemoryContext context); @@ -94,22 +83,19 @@ MemoryContextSwitchTo(MemoryContext context) return old; } #endif /* PG_USE_INLINE || MCXT_INCLUDE_DEFINITIONS */ -#endif /* !FRONTEND */ /* * These are like standard strdup() except the copied string is * allocated in a context, not with malloc(). */ extern char *MemoryContextStrdup(MemoryContext context, const char *string); +#endif /* !FRONTEND */ -#define pstrdup(str) MemoryContextStrdup(CurrentMemoryContext, (str)) - +extern char *pstrdup(const char *in); extern char *pnstrdup(const char *in, Size len); - -#if defined(WIN32) || defined(__CYGWIN__) -extern void *pgport_palloc(Size sz); -extern char *pgport_pstrdup(const char *str); -extern void pgport_pfree(void *pointer); -#endif +extern void *palloc(Size size); +extern void *palloc0(Size size); +extern void pfree(void *pointer); +extern void *repalloc(void *pointer, Size size); #endif /* PALLOC_H */ |