]> git.ipfire.org Git - thirdparty/postgresql.git/commitdiff
Make sure a variable is no longer referenced when it is removed.
authorMichael Meskes <meskes@postgresql.org>
Wed, 11 Jun 2003 06:39:13 +0000 (06:39 +0000)
committerMichael Meskes <meskes@postgresql.org>
Wed, 11 Jun 2003 06:39:13 +0000 (06:39 +0000)
Fixed counting bug in parsing "->" operator.
Removed that silly debugging function I accidently committed last night.

src/interfaces/ecpg/ChangeLog
src/interfaces/ecpg/preproc/preproc.y
src/interfaces/ecpg/preproc/variable.c

index 6e3b5cb54ea4c379887160842cc6c201951e52e2..858c7f911165e7a1bf2709562d6d8637fc904209 100644 (file)
@@ -1477,6 +1477,11 @@ Mon Jun  2 17:36:03 CEST 2003
 Tue Jun 10 19:43:49 CEST 2003
 
        - Fixed several small bugs.
+       
+Wed Jun 11 08:30:41 CEST 2003
+
+       - Make sure a variable is no longer referenced when it is removed.
+       - Fixed counting bug in parsing "->" operator.
        - Set ecpg version to 2.12.0.
        - Set ecpg library to 3.4.2.
        - Set pgtypes library to 1.0.0
index b1e002c05a707d06db5284b051e7da2c51d96ea5..83015d04a59a4a7a56f683ce2d5773cdc57ff520 100644 (file)
@@ -1,4 +1,4 @@
-/* $Header: /cvsroot/pgsql/src/interfaces/ecpg/preproc/Attic/preproc.y,v 1.229 2003/06/10 17:46:43 meskes Exp $ */
+/* $Header: /cvsroot/pgsql/src/interfaces/ecpg/preproc/Attic/preproc.y,v 1.230 2003/06/11 06:39:12 meskes Exp $ */
 
 /* Copyright comment */
 %{
@@ -48,14 +48,6 @@ static struct inf_compat_val
        struct inf_compat_val *next;
 } *informix_val;
 
-void mm(void)
-{
-       int i,j;
-
-       i=1;
-       j=i+1;
-}
-
 /*
  * Handle parsing errors and warnings
  */
@@ -673,7 +665,6 @@ stmt:  AlterDatabaseSetStmt         { output_statement($1, 0, connection); }
                        struct cursor *ptr;
                        struct arguments *p;
 
-               mm();
                        for (ptr = cur; ptr != NULL; ptr=ptr->next)
                        {
                                if (strcmp(ptr->name, $1) == 0)
@@ -2632,7 +2623,6 @@ DeclareCursorStmt:  DECLARE name cursor_options CURSOR opt_hold FOR SelectStmt
                        this = (struct cursor *) mm_alloc(sizeof(struct cursor));
 
                        /* initial definition */
-                       mm();
                        this->next = cur;
                        this->name = $2;
                        this->connection = connection;
index 83b56ac9dc3c0ded0b9e33f69ab8a8e5bff655c8..be96e18c0c5488d38bc3fe5ba0eafb644d39436c 100644 (file)
@@ -137,7 +137,7 @@ find_struct(char *name, char *next, char *end)
                /* restore the name, we will need it later */
                *next = c;
 
-               return find_struct_member(name, end, p->type->u.element->u.members, p->brace_level);
+               return find_struct_member(name, ++end, p->type->u.element->u.members, p->brace_level);
        }
        else
        {
@@ -260,6 +260,37 @@ remove_variables(int brace_level)
        {
                if (p->brace_level >= brace_level)
                {
+                       /* is it still referenced by a cursor? */
+                       struct cursor *ptr;
+
+                        for (ptr = cur; ptr != NULL; ptr = ptr->next)
+                       {
+                               struct arguments *varptr, *prevvar;
+
+                               for (varptr = prevvar = ptr->argsinsert; varptr != NULL; varptr = varptr->next)
+                               {
+                                       if (p == varptr->variable)
+                                       {
+                                               /* remove from list */
+                                               if (varptr == ptr->argsinsert)
+                                                       ptr->argsinsert = varptr->next;
+                                               else
+                                                       prevvar->next = varptr->next;
+                                       }
+                               }
+                               for (varptr = ptr->argsresult; varptr != NULL; varptr = varptr->next)
+                               {
+                                       if (p == varptr->variable)
+                                       {
+                                               /* remove from list */
+                                               if (varptr == ptr->argsresult)
+                                                       ptr->argsresult = varptr->next;
+                                               else
+                                                       prevvar->next = varptr->next;
+                                       }
+                               }
+                       }
+                                                       
                        /* remove it */
                        if (p == allvariables)
                                prev = allvariables = p->next;