1
0
mirror of https://github.com/postgres/postgres.git synced 2025-11-16 15:02:33 +03:00

Massive commit to run PGINDENT on all *.c and *.h files.

This commit is contained in:
Bruce Momjian
1997-09-07 05:04:48 +00:00
parent 8fecd4febf
commit 1ccd423235
687 changed files with 150775 additions and 136888 deletions

View File

@@ -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;
}