From 507a0a2ab09144f524e3239b7fc201ad1ad1b78e Mon Sep 17 00:00:00 2001 From: Tom Lane Date: Thu, 13 May 1999 07:29:22 +0000 Subject: Rip out QueryTreeList structure, root and branch. Querytree lists are now plain old garden-variety Lists, allocated with palloc, rather than specialized expansible-array data allocated with malloc. This substantially simplifies their handling and eliminates several sources of memory leakage. Several basic types of erroneous queries (syntax error, attempt to insert a duplicate key into a unique index) now demonstrably leak zero bytes per query. --- src/backend/executor/functions.c | 23 ++++++++++------------- 1 file changed, 10 insertions(+), 13 deletions(-) (limited to 'src/backend/executor/functions.c') diff --git a/src/backend/executor/functions.c b/src/backend/executor/functions.c index 1cb57d5651e..f9b729b8386 100644 --- a/src/backend/executor/functions.c +++ b/src/backend/executor/functions.c @@ -8,7 +8,7 @@ * * * IDENTIFICATION - * $Header: /cvsroot/pgsql/src/backend/executor/functions.c,v 1.24 1999/02/13 23:15:20 momjian Exp $ + * $Header: /cvsroot/pgsql/src/backend/executor/functions.c,v 1.25 1999/05/13 07:28:29 tgl Exp $ * *------------------------------------------------------------------------- */ @@ -97,26 +97,23 @@ init_execution_state(FunctionCachePtr fcache, execution_state *newes; execution_state *nextes; execution_state *preves; - QueryTreeList *queryTree_list; - int i; - List *planTree_list; - int nargs; - - nargs = fcache->nargs; + List *queryTree_list, + *planTree_list, + *qtl_item; + int nargs = fcache->nargs; newes = (execution_state *) palloc(sizeof(execution_state)); nextes = newes; preves = (execution_state *) NULL; + planTree_list = pg_parse_and_plan(fcache->src, fcache->argOidVect, + nargs, &queryTree_list, None, FALSE); - planTree_list = (List *) - pg_parse_and_plan(fcache->src, fcache->argOidVect, nargs, &queryTree_list, None, FALSE); - - for (i = 0; i < queryTree_list->len; i++) + foreach (qtl_item, queryTree_list) { - EState *estate; - Query *queryTree = (Query *) (queryTree_list->qtrees[i]); + Query *queryTree = lfirst(qtl_item); Plan *planTree = lfirst(planTree_list); + EState *estate; if (!nextes) nextes = (execution_state *) palloc(sizeof(execution_state)); -- cgit v1.2.3