OSDN Git Service

*** empty log message ***
authorMichael Meskes <meskes@postgresql.org>
Thu, 9 Mar 2000 09:17:16 +0000 (09:17 +0000)
committerMichael Meskes <meskes@postgresql.org>
Thu, 9 Mar 2000 09:17:16 +0000 (09:17 +0000)
src/interfaces/ecpg/ChangeLog
src/interfaces/ecpg/lib/Makefile.in
src/interfaces/ecpg/preproc/ecpg.c
src/interfaces/ecpg/preproc/extern.h
src/interfaces/ecpg/preproc/preproc.y
src/interfaces/ecpg/preproc/variable.c

index 41ddead..32bd39b 100644 (file)
@@ -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.
index de846dd..521d697 100644 (file)
@@ -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
index ceb06fb..31bc487 100644 (file)
@@ -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);
index f79c3b4..41b3f9d 100644 (file)
@@ -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);
index e21a67b..78dad88 100644 (file)
@@ -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)
index 98cf325..3de4535 100644 (file)
@@ -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