mirror of
https://github.com/postgres/postgres.git
synced 2025-05-19 00:04:06 -04:00
Add some more Assert checks.
This commit is contained in:
parent
7893462e44
commit
94e90d9a86
@ -14,7 +14,7 @@
|
|||||||
*
|
*
|
||||||
*
|
*
|
||||||
* IDENTIFICATION
|
* IDENTIFICATION
|
||||||
* $Header: /cvsroot/pgsql/src/backend/utils/mmgr/mcxt.c,v 1.23 2000/07/11 14:30:28 momjian Exp $
|
* $Header: /cvsroot/pgsql/src/backend/utils/mmgr/mcxt.c,v 1.24 2000/08/22 04:00:10 tgl Exp $
|
||||||
*
|
*
|
||||||
*-------------------------------------------------------------------------
|
*-------------------------------------------------------------------------
|
||||||
*/
|
*/
|
||||||
@ -114,6 +114,8 @@ MemoryContextInit(void)
|
|||||||
void
|
void
|
||||||
MemoryContextReset(MemoryContext context)
|
MemoryContextReset(MemoryContext context)
|
||||||
{
|
{
|
||||||
|
AssertArg(MemoryContextIsValid(context));
|
||||||
|
|
||||||
MemoryContextResetChildren(context);
|
MemoryContextResetChildren(context);
|
||||||
(*context->methods->reset) (context);
|
(*context->methods->reset) (context);
|
||||||
}
|
}
|
||||||
@ -129,6 +131,8 @@ MemoryContextResetChildren(MemoryContext context)
|
|||||||
{
|
{
|
||||||
MemoryContext child;
|
MemoryContext child;
|
||||||
|
|
||||||
|
AssertArg(MemoryContextIsValid(context));
|
||||||
|
|
||||||
for (child = context->firstchild; child != NULL; child = child->nextchild)
|
for (child = context->firstchild; child != NULL; child = child->nextchild)
|
||||||
{
|
{
|
||||||
MemoryContextReset(child);
|
MemoryContextReset(child);
|
||||||
@ -148,6 +152,7 @@ MemoryContextResetChildren(MemoryContext context)
|
|||||||
void
|
void
|
||||||
MemoryContextDelete(MemoryContext context)
|
MemoryContextDelete(MemoryContext context)
|
||||||
{
|
{
|
||||||
|
AssertArg(MemoryContextIsValid(context));
|
||||||
/* We had better not be deleting TopMemoryContext ... */
|
/* We had better not be deleting TopMemoryContext ... */
|
||||||
Assert(context != TopMemoryContext);
|
Assert(context != TopMemoryContext);
|
||||||
/* And not CurrentMemoryContext, either */
|
/* And not CurrentMemoryContext, either */
|
||||||
@ -194,6 +199,7 @@ MemoryContextDelete(MemoryContext context)
|
|||||||
void
|
void
|
||||||
MemoryContextDeleteChildren(MemoryContext context)
|
MemoryContextDeleteChildren(MemoryContext context)
|
||||||
{
|
{
|
||||||
|
AssertArg(MemoryContextIsValid(context));
|
||||||
/*
|
/*
|
||||||
* MemoryContextDelete will delink the child from me,
|
* MemoryContextDelete will delink the child from me,
|
||||||
* so just iterate as long as there is a child.
|
* so just iterate as long as there is a child.
|
||||||
@ -215,6 +221,8 @@ MemoryContextDeleteChildren(MemoryContext context)
|
|||||||
void
|
void
|
||||||
MemoryContextResetAndDeleteChildren(MemoryContext context)
|
MemoryContextResetAndDeleteChildren(MemoryContext context)
|
||||||
{
|
{
|
||||||
|
AssertArg(MemoryContextIsValid(context));
|
||||||
|
|
||||||
MemoryContextDeleteChildren(context);
|
MemoryContextDeleteChildren(context);
|
||||||
(*context->methods->reset) (context);
|
(*context->methods->reset) (context);
|
||||||
}
|
}
|
||||||
@ -231,6 +239,8 @@ MemoryContextStats(MemoryContext context)
|
|||||||
{
|
{
|
||||||
MemoryContext child;
|
MemoryContext child;
|
||||||
|
|
||||||
|
AssertArg(MemoryContextIsValid(context));
|
||||||
|
|
||||||
(*context->methods->stats) (context);
|
(*context->methods->stats) (context);
|
||||||
for (child = context->firstchild; child != NULL; child = child->nextchild)
|
for (child = context->firstchild; child != NULL; child = child->nextchild)
|
||||||
{
|
{
|
||||||
@ -251,6 +261,8 @@ MemoryContextCheck(MemoryContext context)
|
|||||||
{
|
{
|
||||||
MemoryContext child;
|
MemoryContext child;
|
||||||
|
|
||||||
|
AssertArg(MemoryContextIsValid(context));
|
||||||
|
|
||||||
(*context->methods->check) (context);
|
(*context->methods->check) (context);
|
||||||
for (child = context->firstchild; child != NULL; child = child->nextchild)
|
for (child = context->firstchild; child != NULL; child = child->nextchild)
|
||||||
{
|
{
|
||||||
|
Loading…
x
Reference in New Issue
Block a user