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.
This commit is contained in:
Michael Meskes 2003-06-11 06:39:13 +00:00
parent 8de72414ea
commit 1ca0b6d047
3 changed files with 38 additions and 12 deletions

View 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

View 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;

View 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;