- 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.
# 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
for (ptr = cur; ptr != NULL;)
{
struct cursor *this = ptr;
- struct arguments *l1,
- *l2;
+ struct arguments *l1, *l2;
free(ptr->command);
free(ptr->connection);
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);
}
/* 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)
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