From 8e7764d9c23ee5595b78995346cc7bb78dcf0ebf Mon Sep 17 00:00:00 2001 From: Michael Meskes Date: Thu, 9 Mar 2000 09:17:16 +0000 Subject: [PATCH] *** empty log message *** --- src/interfaces/ecpg/ChangeLog | 4 ++++ src/interfaces/ecpg/lib/Makefile.in | 4 ++-- src/interfaces/ecpg/preproc/ecpg.c | 3 +-- src/interfaces/ecpg/preproc/extern.h | 1 + src/interfaces/ecpg/preproc/preproc.y | 12 +++++------- src/interfaces/ecpg/preproc/variable.c | 22 ++++++++++++++++++++-- 6 files changed, 33 insertions(+), 13 deletions(-) diff --git a/src/interfaces/ecpg/ChangeLog b/src/interfaces/ecpg/ChangeLog index 41ddeadf34..32bd39b5bd 100644 --- a/src/interfaces/ecpg/ChangeLog +++ b/src/interfaces/ecpg/ChangeLog @@ -857,5 +857,9 @@ Tue Mar 7 10:58:21 CET 2000 - More cleanup in ecpglib. - Fixed ecpg.c not not free variable list twice. + +Thu Mar 9 10:12:57 CET 2000 + + - Fixed another memory bug in the parser. - Set library version to 3.1.0. - Set ecpg version to 2.7.0. diff --git a/src/interfaces/ecpg/lib/Makefile.in b/src/interfaces/ecpg/lib/Makefile.in index de846dd7f9..521d697add 100644 --- a/src/interfaces/ecpg/lib/Makefile.in +++ b/src/interfaces/ecpg/lib/Makefile.in @@ -6,13 +6,13 @@ # Copyright (c) 1994, Regents of the University of California # # IDENTIFICATION -# $Header: /cvsroot/pgsql/src/interfaces/ecpg/lib/Attic/Makefile.in,v 1.63 2000/03/08 01:58:24 momjian Exp $ +# $Header: /cvsroot/pgsql/src/interfaces/ecpg/lib/Attic/Makefile.in,v 1.64 2000/03/09 09:17:10 meskes Exp $ # #------------------------------------------------------------------------- NAME= ecpg SO_MAJOR_VERSION= 3 -SO_MINOR_VERSION= 1 +SO_MINOR_VERSION= 1.0 SRCDIR= @top_srcdir@ include $(SRCDIR)/Makefile.global diff --git a/src/interfaces/ecpg/preproc/ecpg.c b/src/interfaces/ecpg/preproc/ecpg.c index ceb06fb744..31bc48752f 100644 --- a/src/interfaces/ecpg/preproc/ecpg.c +++ b/src/interfaces/ecpg/preproc/ecpg.c @@ -177,8 +177,7 @@ main(int argc, char *const argv[]) for (ptr = cur; ptr != NULL;) { struct cursor *this = ptr; - struct arguments *l1, - *l2; + struct arguments *l1, *l2; free(ptr->command); free(ptr->connection); diff --git a/src/interfaces/ecpg/preproc/extern.h b/src/interfaces/ecpg/preproc/extern.h index f79c3b43a0..41b3f9d972 100644 --- a/src/interfaces/ecpg/preproc/extern.h +++ b/src/interfaces/ecpg/preproc/extern.h @@ -59,6 +59,7 @@ extern void add_descriptor(char *,char *); extern void drop_descriptor(char *,char *); extern struct descriptor *lookup_descriptor(char *,char *); extern void add_variable(struct arguments ** , struct variable * , struct variable *); +extern void append_variable(struct arguments ** , struct variable * , struct variable *); extern void dump_variables(struct arguments *, int); extern struct typedefs *get_typedef(char *); extern void adjust_array(enum ECPGttype, int *, int *, int, int, bool); diff --git a/src/interfaces/ecpg/preproc/preproc.y b/src/interfaces/ecpg/preproc/preproc.y index e21a67b080..78dad88c4f 100644 --- a/src/interfaces/ecpg/preproc/preproc.y +++ b/src/interfaces/ecpg/preproc/preproc.y @@ -525,15 +525,13 @@ stmt: AlterTableStmt { output_statement($1, 0, NULL, connection); } } /* merge variables given in prepare statement with those given here */ - for (p = argsinsert; p && p->next; p = p->next); - if (p) - p->next = ptr->argsinsert; - else - argsinsert = ptr->argsinsert; + for (p = ptr->argsinsert; p; p = p->next) + append_variable(&argsinsert, p->variable, p->indicator); - argsresult = ptr->argsresult; + for (p = ptr->argsresult; p; p = p->next) + add_variable(&argsresult, p->variable, p->indicator); - output_statement(ptr->command, 0, NULL, ptr->connection); + output_statement(mm_strdup(ptr->command), 0, NULL, ptr->connection ? mm_strdup(ptr->connection) : NULL); } | ECPGPrepare { if (connection) diff --git a/src/interfaces/ecpg/preproc/variable.c b/src/interfaces/ecpg/preproc/variable.c index 98cf32576d..3de45350b1 100644 --- a/src/interfaces/ecpg/preproc/variable.c +++ b/src/interfaces/ecpg/preproc/variable.c @@ -189,17 +189,35 @@ reset_variables(void) argsresult = NULL; } -/* Add a variable to a request. */ +/* Insert a new variable into our request list. */ void add_variable(struct arguments ** list, struct variable * var, struct variable * ind) { - struct arguments * p = (struct arguments *)mm_alloc(sizeof(struct arguments)); + struct arguments *p = (struct arguments *)mm_alloc(sizeof(struct arguments)); + p->variable = var; p->indicator = ind; p->next = *list; *list = p; } +/* Append a new variable to our request list. */ +void +append_variable(struct arguments ** list, struct variable * var, struct variable * ind) +{ + struct arguments *p, *new = (struct arguments *)mm_alloc(sizeof(struct arguments)); + + for (p = *list; p && p->next; p = p->next); + + new->variable = var; + new->indicator = ind; + new->next = NULL; + + if (p) + p->next = new; + else + *list = new; +} /* Dump out a list of all the variable on this list. This is a recursive function that works from the end of the list and -- 2.40.0