aboutsummaryrefslogtreecommitdiff
path: root/src/backend/utils/mmgr/palloc.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/backend/utils/mmgr/palloc.c')
-rw-r--r--src/backend/utils/mmgr/palloc.c82
1 files changed, 41 insertions, 41 deletions
diff --git a/src/backend/utils/mmgr/palloc.c b/src/backend/utils/mmgr/palloc.c
index 8830a21f40a..f644706c911 100644
--- a/src/backend/utils/mmgr/palloc.c
+++ b/src/backend/utils/mmgr/palloc.c
@@ -1,13 +1,13 @@
/*-------------------------------------------------------------------------
*
* palloc.c--
- * POSTGRES memory allocator code.
+ * POSTGRES memory allocator code.
*
* Copyright (c) 1994, Regents of the University of California
*
*
* IDENTIFICATION
- * $Header: /cvsroot/pgsql/src/backend/utils/mmgr/Attic/palloc.c,v 1.3 1996/11/26 03:19:12 bryanh Exp $
+ * $Header: /cvsroot/pgsql/src/backend/utils/mmgr/Attic/palloc.c,v 1.4 1997/09/07 04:54:12 momjian Exp $
*
*-------------------------------------------------------------------------
*/
@@ -25,7 +25,7 @@
#include "utils/palloc.h"
/* ----------------------------------------------------------------
- * User library functions
+ * User library functions
* ----------------------------------------------------------------
*/
@@ -36,84 +36,84 @@
#undef malloc
#undef free
-/* define PALLOC_IS_MALLOC if you want palloc to go straight to the
+/* define PALLOC_IS_MALLOC if you want palloc to go straight to the
raw malloc, without concern for the extra bookkeeping needed to
ensure garbage is collected at the end of transactions - jolly 1/12/94 */
/*
* palloc --
- * Returns pointer to aligned memory of specified size.
+ * Returns pointer to aligned memory of specified size.
*
* Exceptions:
- * BadArgument if size < 1 or size >= MaxAllocSize.
- * ExhaustedMemory if allocation fails.
- * NonallocatedPointer if pointer was not returned by palloc or repalloc
- * or may have been freed already.
+ * BadArgument if size < 1 or size >= MaxAllocSize.
+ * ExhaustedMemory if allocation fails.
+ * NonallocatedPointer if pointer was not returned by palloc or repalloc
+ * or may have been freed already.
*
* pfree --
- * Frees memory associated with pointer returned from palloc or repalloc.
+ * Frees memory associated with pointer returned from palloc or repalloc.
*
* Exceptions:
- * BadArgument if pointer is invalid.
- * FreeInWrongContext if pointer was allocated in a different "context."
- * NonallocatedPointer if pointer was not returned by palloc or repalloc
- * or may have been subsequently freed.
+ * BadArgument if pointer is invalid.
+ * FreeInWrongContext if pointer was allocated in a different "context."
+ * NonallocatedPointer if pointer was not returned by palloc or repalloc
+ * or may have been subsequently freed.
*/
-void*
+void *
palloc(Size size)
{
#ifdef PALLOC_IS_MALLOC
- return malloc(size);
+ return malloc(size);
#else
- return (MemoryContextAlloc(CurrentMemoryContext, size));
-#endif /* PALLOC_IS_MALLOC */
+ return (MemoryContextAlloc(CurrentMemoryContext, size));
+#endif /* PALLOC_IS_MALLOC */
}
void
pfree(void *pointer)
-{
+{
#ifdef PALLOC_IS_MALLOC
- free(pointer);
+ free(pointer);
#else
- MemoryContextFree(CurrentMemoryContext, pointer);
-#endif /* PALLOC_IS_MALLOC */
+ MemoryContextFree(CurrentMemoryContext, pointer);
+#endif /* PALLOC_IS_MALLOC */
}
/*
* repalloc --
- * Returns pointer to aligned memory of specified size.
+ * Returns pointer to aligned memory of specified size.
*
* Side effects:
- * The returned memory is first filled with the contents of *pointer
- * up to the minimum of size and psize(pointer). Pointer is freed.
+ * The returned memory is first filled with the contents of *pointer
+ * up to the minimum of size and psize(pointer). Pointer is freed.
*
* Exceptions:
- * BadArgument if pointer is invalid or size < 1 or size >= MaxAllocSize.
- * ExhaustedMemory if allocation fails.
- * NonallocatedPointer if pointer was not returned by palloc or repalloc
- * or may have been freed already.
+ * BadArgument if pointer is invalid or size < 1 or size >= MaxAllocSize.
+ * ExhaustedMemory if allocation fails.
+ * NonallocatedPointer if pointer was not returned by palloc or repalloc
+ * or may have been freed already.
*/
-void *
+void *
repalloc(void *pointer, Size size)
{
#ifdef PALLOC_IS_MALLOC
- return realloc(pointer, size);
+ return realloc(pointer, size);
#else
- return (MemoryContextRealloc(CurrentMemoryContext, pointer, size));
+ return (MemoryContextRealloc(CurrentMemoryContext, pointer, size));
#endif
}
-/* pstrdup
- allocates space for and copies a string
- just like strdup except it uses palloc instead of malloc */
-char*
-pstrdup(char* string)
+/* pstrdup
+ allocates space for and copies a string
+ just like strdup except it uses palloc instead of malloc */
+char *
+pstrdup(char *string)
{
- char *nstr;
+ char *nstr;
- nstr = (char *)palloc(strlen(string)+1);
- strcpy(nstr, string);
+ nstr = (char *) palloc(strlen(string) + 1);
+ strcpy(nstr, string);
- return nstr;
+ return nstr;
}