Commit 1ca0b6d0 authored by Michael Meskes's avatar Michael Meskes

Make sure a variable is no longer referenced when it is removed.

Fixed counting bug in parsing "->" operator.
Removed that silly debugging function I accidently committed last night.
parent 8de72414
...@@ -1477,6 +1477,11 @@ Mon Jun 2 17:36:03 CEST 2003 ...@@ -1477,6 +1477,11 @@ Mon Jun 2 17:36:03 CEST 2003
Tue Jun 10 19:43:49 CEST 2003 Tue Jun 10 19:43:49 CEST 2003
- Fixed several small bugs. - 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 version to 2.12.0.
- Set ecpg library to 3.4.2. - Set ecpg library to 3.4.2.
- Set pgtypes library to 1.0.0 - Set pgtypes library to 1.0.0
......
/* $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 */ /* Copyright comment */
%{ %{
...@@ -48,14 +48,6 @@ static struct inf_compat_val ...@@ -48,14 +48,6 @@ static struct inf_compat_val
struct inf_compat_val *next; struct inf_compat_val *next;
} *informix_val; } *informix_val;
void mm(void)
{
int i,j;
i=1;
j=i+1;
}
/* /*
* Handle parsing errors and warnings * Handle parsing errors and warnings
*/ */
...@@ -673,7 +665,6 @@ stmt: AlterDatabaseSetStmt { output_statement($1, 0, connection); } ...@@ -673,7 +665,6 @@ stmt: AlterDatabaseSetStmt { output_statement($1, 0, connection); }
struct cursor *ptr; struct cursor *ptr;
struct arguments *p; struct arguments *p;
mm();
for (ptr = cur; ptr != NULL; ptr=ptr->next) for (ptr = cur; ptr != NULL; ptr=ptr->next)
{ {
if (strcmp(ptr->name, $1) == 0) if (strcmp(ptr->name, $1) == 0)
...@@ -2632,7 +2623,6 @@ DeclareCursorStmt: DECLARE name cursor_options CURSOR opt_hold FOR SelectStmt ...@@ -2632,7 +2623,6 @@ DeclareCursorStmt: DECLARE name cursor_options CURSOR opt_hold FOR SelectStmt
this = (struct cursor *) mm_alloc(sizeof(struct cursor)); this = (struct cursor *) mm_alloc(sizeof(struct cursor));
/* initial definition */ /* initial definition */
mm();
this->next = cur; this->next = cur;
this->name = $2; this->name = $2;
this->connection = connection; this->connection = connection;
......
...@@ -137,7 +137,7 @@ find_struct(char *name, char *next, char *end) ...@@ -137,7 +137,7 @@ find_struct(char *name, char *next, char *end)
/* restore the name, we will need it later */ /* restore the name, we will need it later */
*next = c; *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 else
{ {
...@@ -260,6 +260,37 @@ remove_variables(int brace_level) ...@@ -260,6 +260,37 @@ remove_variables(int brace_level)
{ {
if (p->brace_level >= 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 */ /* remove it */
if (p == allvariables) if (p == allvariables)
prev = allvariables = p->next; prev = allvariables = p->next;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment