1
0
mirror of https://github.com/postgres/postgres.git synced 2025-12-01 12:18:01 +03:00

Standard pgindent run for 8.1.

This commit is contained in:
Bruce Momjian
2005-10-15 02:49:52 +00:00
parent 790c01d280
commit 1dc3498251
770 changed files with 34334 additions and 32507 deletions

View File

@@ -11,7 +11,7 @@
* Portions Copyright (c) 1994, Regents of the University of California
*
* IDENTIFICATION
* $PostgreSQL: pgsql/src/backend/utils/mmgr/aset.c,v 1.63 2005/09/01 18:15:42 tgl Exp $
* $PostgreSQL: pgsql/src/backend/utils/mmgr/aset.c,v 1.64 2005/10/15 02:49:36 momjian Exp $
*
* NOTE:
* This is a new (Feb. 05, 1999) implementation of the allocation set
@@ -140,8 +140,7 @@ typedef struct AllocSetContext
/* Allocation parameters for this context: */
Size initBlockSize; /* initial block size */
Size maxBlockSize; /* maximum block size */
AllocBlock keeper; /* if not NULL, keep this block over
* resets */
AllocBlock keeper; /* if not NULL, keep this block over resets */
} AllocSetContext;
typedef AllocSetContext *AllocSet;
@@ -342,8 +341,8 @@ AllocSetContextCreate(MemoryContext parent,
ereport(ERROR,
(errcode(ERRCODE_OUT_OF_MEMORY),
errmsg("out of memory"),
errdetail("Failed while creating memory context \"%s\".",
name)));
errdetail("Failed while creating memory context \"%s\".",
name)));
}
block->aset = context;
block->freeptr = ((char *) block) + ALLOC_BLOCKHDRSZ;
@@ -505,8 +504,8 @@ AllocSetAlloc(MemoryContext context, Size size)
AssertArg(AllocSetIsValid(set));
/*
* If requested size exceeds maximum for chunks, allocate an entire
* block for this request.
* If requested size exceeds maximum for chunks, allocate an entire block
* for this request.
*/
if (size > ALLOC_CHUNK_LIMIT)
{
@@ -536,8 +535,8 @@ AllocSetAlloc(MemoryContext context, Size size)
#endif
/*
* Stick the new block underneath the active allocation block, so
* that we don't lose the use of the space remaining therein.
* Stick the new block underneath the active allocation block, so that
* we don't lose the use of the space remaining therein.
*/
if (set->blocks != NULL)
{
@@ -558,8 +557,7 @@ AllocSetAlloc(MemoryContext context, Size size)
/*
* Request is small enough to be treated as a chunk. Look in the
* corresponding free list to see if there is a free chunk we could
* reuse.
* corresponding free list to see if there is a free chunk we could reuse.
*/
fidx = AllocSetFreeIndex(size);
priorfree = NULL;
@@ -571,8 +569,8 @@ AllocSetAlloc(MemoryContext context, Size size)
}
/*
* If one is found, remove it from the free list, make it again a
* member of the alloc set and return its data address.
* If one is found, remove it from the free list, make it again a member
* of the alloc set and return its data address.
*/
if (chunk != NULL)
{
@@ -604,8 +602,8 @@ AllocSetAlloc(MemoryContext context, Size size)
Assert(chunk_size >= size);
/*
* If there is enough room in the active allocation block, we will put
* the chunk into that block. Else must start a new one.
* If there is enough room in the active allocation block, we will put the
* chunk into that block. Else must start a new one.
*/
if ((block = set->blocks) != NULL)
{
@@ -614,16 +612,16 @@ AllocSetAlloc(MemoryContext context, Size size)
if (availspace < (chunk_size + ALLOC_CHUNKHDRSZ))
{
/*
* The existing active (top) block does not have enough room
* for the requested allocation, but it might still have a
* useful amount of space in it. Once we push it down in the
* block list, we'll never try to allocate more space from it.
* So, before we do that, carve up its free space into chunks
* that we can put on the set's freelists.
* The existing active (top) block does not have enough room for
* the requested allocation, but it might still have a useful
* amount of space in it. Once we push it down in the block list,
* we'll never try to allocate more space from it. So, before we
* do that, carve up its free space into chunks that we can put on
* the set's freelists.
*
* Because we can only get here when there's less than
* ALLOC_CHUNK_LIMIT left in the block, this loop cannot
* iterate more than ALLOCSET_NUM_FREELISTS-1 times.
* ALLOC_CHUNK_LIMIT left in the block, this loop cannot iterate
* more than ALLOCSET_NUM_FREELISTS-1 times.
*/
while (availspace >= ((1 << ALLOC_MINBITS) + ALLOC_CHUNKHDRSZ))
{
@@ -631,10 +629,9 @@ AllocSetAlloc(MemoryContext context, Size size)
int a_fidx = AllocSetFreeIndex(availchunk);
/*
* In most cases, we'll get back the index of the next
* larger freelist than the one we need to put this chunk
* on. The exception is when availchunk is exactly a
* power of 2.
* In most cases, we'll get back the index of the next larger
* freelist than the one we need to put this chunk on. The
* exception is when availchunk is exactly a power of 2.
*/
if (availchunk != (1 << (a_fidx + ALLOC_MINBITS)))
{
@@ -676,11 +673,11 @@ AllocSetAlloc(MemoryContext context, Size size)
else
{
/*
* Use first power of 2 that is larger than previous block,
* but not more than the allowed limit. (We don't simply
* double the prior block size, because in some cases this
* could be a funny size, eg if very first allocation was for
* an odd-sized large chunk.)
* Use first power of 2 that is larger than previous block, but
* not more than the allowed limit. (We don't simply double the
* prior block size, because in some cases this could be a funny
* size, eg if very first allocation was for an odd-sized large
* chunk.)
*/
Size pblksize = set->blocks->endptr - ((char *) set->blocks);
@@ -692,8 +689,8 @@ AllocSetAlloc(MemoryContext context, Size size)
}
/*
* If initBlockSize is less than ALLOC_CHUNK_LIMIT, we could need
* more space... but try to keep it a power of 2.
* If initBlockSize is less than ALLOC_CHUNK_LIMIT, we could need more
* space... but try to keep it a power of 2.
*/
required_size = chunk_size + ALLOC_BLOCKHDRSZ + ALLOC_CHUNKHDRSZ;
while (blksize < required_size)
@@ -703,9 +700,8 @@ AllocSetAlloc(MemoryContext context, Size size)
block = (AllocBlock) malloc(blksize);
/*
* We could be asking for pretty big blocks here, so cope if
* malloc fails. But give up if there's less than a meg or so
* available...
* We could be asking for pretty big blocks here, so cope if malloc
* fails. But give up if there's less than a meg or so available...
*/
while (block == NULL && blksize > 1024 * 1024)
{
@@ -730,13 +726,13 @@ AllocSetAlloc(MemoryContext context, Size size)
block->endptr = ((char *) block) + blksize;
/*
* If this is the first block of the set, make it the "keeper"
* block. Formerly, a keeper block could only be created during
* context creation, but allowing it to happen here lets us have
* fast reset cycling even for contexts created with
* minContextSize = 0; that way we don't have to force space to be
* allocated in contexts that might never need any space. Don't
* mark an oversize block as a keeper, however.
* If this is the first block of the set, make it the "keeper" block.
* Formerly, a keeper block could only be created during context
* creation, but allowing it to happen here lets us have fast reset
* cycling even for contexts created with minContextSize = 0; that way
* we don't have to force space to be allocated in contexts that might
* never need any space. Don't mark an oversize block as a keeper,
* however.
*/
if (set->blocks == NULL && blksize == set->initBlockSize)
{
@@ -870,8 +866,8 @@ AllocSetRealloc(MemoryContext context, void *pointer, Size size)
/*
* Chunk sizes are aligned to power of 2 in AllocSetAlloc(). Maybe the
* allocated area already is >= the new size. (In particular, we
* always fall out here if the requested size is a decrease.)
* allocated area already is >= the new size. (In particular, we always
* fall out here if the requested size is a decrease.)
*/
if (oldsize >= size)
{
@@ -887,9 +883,9 @@ AllocSetRealloc(MemoryContext context, void *pointer, Size size)
if (oldsize > ALLOC_CHUNK_LIMIT)
{
/*
* The chunk must been allocated as a single-chunk block. Find
* the containing block and use realloc() to make it bigger with
* minimum space wastage.
* The chunk must been allocated as a single-chunk block. Find the
* containing block and use realloc() to make it bigger with minimum
* space wastage.
*/
AllocBlock block = set->blocks;
AllocBlock prevblock = NULL;
@@ -944,15 +940,15 @@ AllocSetRealloc(MemoryContext context, void *pointer, Size size)
else
{
/*
* Small-chunk case. If the chunk is the last one in its block,
* there might be enough free space after it that we can just
* enlarge the chunk in-place. It's relatively painful to find
* the containing block in the general case, but we can detect
* last-ness quite cheaply for the typical case where the chunk is
* in the active (topmost) allocation block. (At least with the
* regression tests and code as of 1/2001, realloc'ing the last
* chunk of a non-topmost block hardly ever happens, so it's not
* worth scanning the block list to catch that case.)
* Small-chunk case. If the chunk is the last one in its block, there
* might be enough free space after it that we can just enlarge the
* chunk in-place. It's relatively painful to find the containing
* block in the general case, but we can detect last-ness quite
* cheaply for the typical case where the chunk is in the active
* (topmost) allocation block. (At least with the regression tests
* and code as of 1/2001, realloc'ing the last chunk of a non-topmost
* block hardly ever happens, so it's not worth scanning the block
* list to catch that case.)
*
* NOTE: must be careful not to create a chunk of a size that
* AllocSetAlloc would not create, else we'll get confused later.
@@ -1031,10 +1027,10 @@ AllocSetIsEmpty(MemoryContext context)
AllocSet set = (AllocSet) context;
/*
* For now, we say "empty" only if the context is new or just reset.
* We could examine the freelists to determine if all space has been
* freed, but it's not really worth the trouble for present uses of
* this functionality.
* For now, we say "empty" only if the context is new or just reset. We
* could examine the freelists to determine if all space has been freed,
* but it's not really worth the trouble for present uses of this
* functionality.
*/
if (set->isReset)
return true;
@@ -1073,7 +1069,7 @@ AllocSetStats(MemoryContext context)
}
}
fprintf(stderr,
"%s: %ld total in %ld blocks; %ld free (%ld chunks); %ld used\n",
"%s: %ld total in %ld blocks; %ld free (%ld chunks); %ld used\n",
set->header.name, totalspace, nblocks, freespace, nchunks,
totalspace - freespace);
}
@@ -1144,9 +1140,9 @@ AllocSetCheck(MemoryContext context)
name, chunk, block);
/*
* If chunk is allocated, check for correct aset pointer. (If
* it's free, the aset is the freelist pointer, which we can't
* check as easily...)
* If chunk is allocated, check for correct aset pointer. (If it's
* free, the aset is the freelist pointer, which we can't check as
* easily...)
*/
if (dsize > 0 && chunk->aset != (void *) set)
elog(WARNING, "problem in alloc set %s: bogus aset link in block %p, chunk %p",

View File

@@ -14,7 +14,7 @@
*
*
* IDENTIFICATION
* $PostgreSQL: pgsql/src/backend/utils/mmgr/mcxt.c,v 1.55 2005/05/14 23:16:29 tgl Exp $
* $PostgreSQL: pgsql/src/backend/utils/mmgr/mcxt.c,v 1.56 2005/10/15 02:49:36 momjian Exp $
*
*-------------------------------------------------------------------------
*/
@@ -78,8 +78,8 @@ MemoryContextInit(void)
AssertState(TopMemoryContext == NULL);
/*
* Initialize TopMemoryContext as an AllocSetContext with slow growth
* rate --- we don't really expect much to be allocated in it.
* Initialize TopMemoryContext as an AllocSetContext with slow growth rate
* --- we don't really expect much to be allocated in it.
*
* (There is special-case code in MemoryContextCreate() for this call.)
*/
@@ -90,18 +90,18 @@ MemoryContextInit(void)
8 * 1024);
/*
* Not having any other place to point CurrentMemoryContext, make it
* point to TopMemoryContext. Caller should change this soon!
* Not having any other place to point CurrentMemoryContext, make it point
* to TopMemoryContext. Caller should change this soon!
*/
CurrentMemoryContext = TopMemoryContext;
/*
* Initialize ErrorContext as an AllocSetContext with slow growth rate
* --- we don't really expect much to be allocated in it. More to the
* point, require it to contain at least 8K at all times. This is the
* only case where retained memory in a context is *essential* --- we
* want to be sure ErrorContext still has some memory even if we've
* run out elsewhere!
* Initialize ErrorContext as an AllocSetContext with slow growth rate ---
* we don't really expect much to be allocated in it. More to the point,
* require it to contain at least 8K at all times. This is the only case
* where retained memory in a context is *essential* --- we want to be
* sure ErrorContext still has some memory even if we've run out
* elsewhere!
*/
ErrorContext = AllocSetContextCreate(TopMemoryContext,
"ErrorContext",
@@ -169,9 +169,9 @@ MemoryContextDelete(MemoryContext context)
MemoryContextDeleteChildren(context);
/*
* We delink the context from its parent before deleting it, so that
* if there's an error we won't have deleted/busted contexts still
* attached to the context tree. Better a leak than a crash.
* We delink the context from its parent before deleting it, so that if
* there's an error we won't have deleted/busted contexts still attached
* to the context tree. Better a leak than a crash.
*/
if (context->parent)
{
@@ -208,8 +208,8 @@ MemoryContextDeleteChildren(MemoryContext context)
AssertArg(MemoryContextIsValid(context));
/*
* MemoryContextDelete will delink the child from me, so just iterate
* as long as there is a child.
* MemoryContextDelete will delink the child from me, so just iterate as
* long as there is a child.
*/
while (context->firstchild != NULL)
MemoryContextDelete(context->firstchild);
@@ -384,9 +384,9 @@ MemoryContextContains(MemoryContext context, void *pointer)
((char *) pointer - STANDARDCHUNKHEADERSIZE);
/*
* If the context link doesn't match then we certainly have a
* non-member chunk. Also check for a reasonable-looking size as
* extra guard against being fooled by bogus pointers.
* If the context link doesn't match then we certainly have a non-member
* chunk. Also check for a reasonable-looking size as extra guard against
* being fooled by bogus pointers.
*/
if (header->context == context && AllocSizeIsValid(header->size))
return true;
@@ -640,7 +640,6 @@ MemoryContextSwitchTo(MemoryContext context)
CurrentMemoryContext = context;
return old;
}
#endif /* ! __GNUC__ */
/*

View File

@@ -12,7 +12,7 @@
* Portions Copyright (c) 1994, Regents of the University of California
*
* IDENTIFICATION
* $PostgreSQL: pgsql/src/backend/utils/mmgr/portalmem.c,v 1.81 2005/06/17 22:32:47 tgl Exp $
* $PostgreSQL: pgsql/src/backend/utils/mmgr/portalmem.c,v 1.82 2005/10/15 02:49:36 momjian Exp $
*
*-------------------------------------------------------------------------
*/
@@ -272,8 +272,8 @@ PortalCreateHoldStore(Portal portal)
Assert(portal->holdStore == NULL);
/*
* Create the memory context that is used for storage of the tuple
* set. Note this is NOT a child of the portal's heap memory.
* Create the memory context that is used for storage of the tuple set.
* Note this is NOT a child of the portal's heap memory.
*/
portal->holdContext =
AllocSetContextCreate(PortalMemory,
@@ -305,10 +305,10 @@ PortalDrop(Portal portal, bool isTopCommit)
elog(ERROR, "cannot drop active portal");
/*
* Remove portal from hash table. Because we do this first, we will
* not come back to try to remove the portal again if there's any
* error in the subsequent steps. Better to leak a little memory than
* to get into an infinite error-recovery loop.
* Remove portal from hash table. Because we do this first, we will not
* come back to try to remove the portal again if there's any error in the
* subsequent steps. Better to leak a little memory than to get into an
* infinite error-recovery loop.
*/
PortalHashTableDelete(portal);
@@ -317,27 +317,27 @@ PortalDrop(Portal portal, bool isTopCommit)
(*portal->cleanup) (portal);
/*
* Release any resources still attached to the portal. There are
* several cases being covered here:
* Release any resources still attached to the portal. There are several
* cases being covered here:
*
* Top transaction commit (indicated by isTopCommit): normally we should
* do nothing here and let the regular end-of-transaction resource
* releasing mechanism handle these resources too. However, if we
* have a FAILED portal (eg, a cursor that got an error), we'd better
* clean up its resources to avoid resource-leakage warning messages.
* Top transaction commit (indicated by isTopCommit): normally we should do
* nothing here and let the regular end-of-transaction resource releasing
* mechanism handle these resources too. However, if we have a FAILED
* portal (eg, a cursor that got an error), we'd better clean up its
* resources to avoid resource-leakage warning messages.
*
* Sub transaction commit: never comes here at all, since we don't kill
* any portals in AtSubCommit_Portals().
* Sub transaction commit: never comes here at all, since we don't kill any
* portals in AtSubCommit_Portals().
*
* Main or sub transaction abort: we will do nothing here because
* portal->resowner was already set NULL; the resources were already
* cleaned up in transaction abort.
*
* Ordinary portal drop: must release resources. However, if the portal
* is not FAILED then we do not release its locks. The locks become
* the responsibility of the transaction's ResourceOwner (since it is
* the parent of the portal's owner) and will be released when the
* transaction eventually ends.
* Ordinary portal drop: must release resources. However, if the portal is
* not FAILED then we do not release its locks. The locks become the
* responsibility of the transaction's ResourceOwner (since it is the
* parent of the portal's owner) and will be released when the transaction
* eventually ends.
*/
if (portal->resowner &&
(!isTopCommit || portal->status == PORTAL_FAILED))
@@ -419,7 +419,7 @@ DropDependentPortals(MemoryContext queryContext)
bool
CommitHoldablePortals(void)
{
bool result = false;
bool result = false;
HASH_SEQ_STATUS status;
PortalHashEnt *hentry;
@@ -435,27 +435,26 @@ CommitHoldablePortals(void)
portal->status == PORTAL_READY)
{
/*
* We are exiting the transaction that created a holdable
* cursor. Instead of dropping the portal, prepare it for
* access by later transactions.
* We are exiting the transaction that created a holdable cursor.
* Instead of dropping the portal, prepare it for access by later
* transactions.
*
* Note that PersistHoldablePortal() must release all resources
* used by the portal that are local to the creating
* transaction.
* Note that PersistHoldablePortal() must release all resources used
* by the portal that are local to the creating transaction.
*/
PortalCreateHoldStore(portal);
PersistHoldablePortal(portal);
/*
* Any resources belonging to the portal will be released in
* the upcoming transaction-wide cleanup; the portal will no
* longer have its own resources.
* Any resources belonging to the portal will be released in the
* upcoming transaction-wide cleanup; the portal will no longer
* have its own resources.
*/
portal->resowner = NULL;
/*
* Having successfully exported the holdable cursor, mark it
* as not belonging to this transaction.
* Having successfully exported the holdable cursor, mark it as
* not belonging to this transaction.
*/
portal->createSubid = InvalidSubTransactionId;
@@ -480,7 +479,7 @@ CommitHoldablePortals(void)
bool
PrepareHoldablePortals(void)
{
bool result = false;
bool result = false;
HASH_SEQ_STATUS status;
PortalHashEnt *hentry;
@@ -496,8 +495,8 @@ PrepareHoldablePortals(void)
portal->status == PORTAL_READY)
{
/*
* We are exiting the transaction that created a holdable
* cursor. Can't do PREPARE.
* We are exiting the transaction that created a holdable cursor.
* Can't do PREPARE.
*/
ereport(ERROR,
(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
@@ -527,8 +526,8 @@ AtCommit_Portals(void)
Portal portal = hentry->portal;
/*
* Do not touch active portals --- this can only happen in the
* case of a multi-transaction utility command, such as VACUUM.
* Do not touch active portals --- this can only happen in the case of
* a multi-transaction utility command, such as VACUUM.
*
* Note however that any resource owner attached to such a portal is
* still going to go away, so don't leave a dangling pointer.
@@ -579,8 +578,7 @@ AtAbort_Portals(void)
portal->status = PORTAL_FAILED;
/*
* Do nothing else to cursors held over from a previous
* transaction.
* Do nothing else to cursors held over from a previous transaction.
*/
if (portal->createSubid == InvalidSubTransactionId)
continue;
@@ -594,8 +592,8 @@ AtAbort_Portals(void)
/*
* Any resources belonging to the portal will be released in the
* upcoming transaction-wide cleanup; they will be gone before we
* run PortalDrop.
* upcoming transaction-wide cleanup; they will be gone before we run
* PortalDrop.
*/
portal->resowner = NULL;
}
@@ -686,11 +684,10 @@ AtSubAbort_Portals(SubTransactionId mySubid,
continue;
/*
* Force any active portals of my own transaction into FAILED
* state. This is mostly to ensure that a portal running a FETCH
* will go FAILED if the underlying cursor fails. (Note we do NOT
* want to do this to upper-level portals, since they may be able
* to continue.)
* Force any active portals of my own transaction into FAILED state.
* This is mostly to ensure that a portal running a FETCH will go
* FAILED if the underlying cursor fails. (Note we do NOT want to do
* this to upper-level portals, since they may be able to continue.)
*
* This is only needed to dodge the sanity check in PortalDrop.
*/
@@ -701,11 +698,11 @@ AtSubAbort_Portals(SubTransactionId mySubid,
* If the portal is READY then allow it to survive into the parent
* transaction; otherwise shut it down.
*
* Currently, we can't actually support that because the portal's
* query might refer to objects created or changed in the failed
* subtransaction, leading to crashes if execution is resumed.
* So, even READY portals are deleted. It would be nice to detect
* whether the query actually depends on any such object, instead.
* Currently, we can't actually support that because the portal's query
* might refer to objects created or changed in the failed
* subtransaction, leading to crashes if execution is resumed. So,
* even READY portals are deleted. It would be nice to detect whether
* the query actually depends on any such object, instead.
*/
#ifdef NOT_USED
if (portal->status == PORTAL_READY)
@@ -725,9 +722,9 @@ AtSubAbort_Portals(SubTransactionId mySubid,
}
/*
* Any resources belonging to the portal will be released in
* the upcoming transaction-wide cleanup; they will be gone
* before we run PortalDrop.
* Any resources belonging to the portal will be released in the
* upcoming transaction-wide cleanup; they will be gone before we
* run PortalDrop.
*/
portal->resowner = NULL;
}