1414 *
1515 *
1616 * IDENTIFICATION
17- * $Header: /cvsroot/pgsql/src/backend/utils/mmgr/mcxt.c,v 1.23 2000/07/11 14:30:28 momjian Exp $
17+ * $Header: /cvsroot/pgsql/src/backend/utils/mmgr/mcxt.c,v 1.24 2000/08/22 04:00:10 tgl Exp $
1818 *
1919 *-------------------------------------------------------------------------
2020 */
@@ -114,6 +114,8 @@ MemoryContextInit(void)
114114void
115115MemoryContextReset (MemoryContext context )
116116{
117+ AssertArg (MemoryContextIsValid (context ));
118+
117119MemoryContextResetChildren (context );
118120(* context -> methods -> reset ) (context );
119121}
@@ -129,6 +131,8 @@ MemoryContextResetChildren(MemoryContext context)
129131{
130132MemoryContext child ;
131133
134+ AssertArg (MemoryContextIsValid (context ));
135+
132136for (child = context -> firstchild ;child != NULL ;child = child -> nextchild )
133137{
134138MemoryContextReset (child );
@@ -148,6 +152,7 @@ MemoryContextResetChildren(MemoryContext context)
148152void
149153MemoryContextDelete (MemoryContext context )
150154{
155+ AssertArg (MemoryContextIsValid (context ));
151156/* We had better not be deleting TopMemoryContext ... */
152157Assert (context != TopMemoryContext );
153158/* And not CurrentMemoryContext, either */
@@ -194,6 +199,7 @@ MemoryContextDelete(MemoryContext context)
194199void
195200MemoryContextDeleteChildren (MemoryContext context )
196201{
202+ AssertArg (MemoryContextIsValid (context ));
197203/*
198204 * MemoryContextDelete will delink the child from me,
199205 * so just iterate as long as there is a child.
@@ -215,6 +221,8 @@ MemoryContextDeleteChildren(MemoryContext context)
215221void
216222MemoryContextResetAndDeleteChildren (MemoryContext context )
217223{
224+ AssertArg (MemoryContextIsValid (context ));
225+
218226MemoryContextDeleteChildren (context );
219227(* context -> methods -> reset ) (context );
220228}
@@ -231,6 +239,8 @@ MemoryContextStats(MemoryContext context)
231239{
232240MemoryContext child ;
233241
242+ AssertArg (MemoryContextIsValid (context ));
243+
234244(* context -> methods -> stats ) (context );
235245for (child = context -> firstchild ;child != NULL ;child = child -> nextchild )
236246{
@@ -251,6 +261,8 @@ MemoryContextCheck(MemoryContext context)
251261{
252262MemoryContext child ;
253263
264+ AssertArg (MemoryContextIsValid (context ));
265+
254266(* context -> methods -> check ) (context );
255267for (child = context -> firstchild ;child != NULL ;child = child -> nextchild )
256268{