Skip to content

Commit 1ca0b6d

Browse files
author
Michael Meskes
committed
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.
1 parent 8de7241 commit 1ca0b6d

File tree

3 files changed

+38
-12
lines changed

3 files changed

+38
-12
lines changed

src/interfaces/ecpg/ChangeLog

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1477,6 +1477,11 @@ Mon Jun 2 17:36:03 CEST 2003
14771477
Tue Jun 10 19:43:49 CEST 2003
14781478

14791479
- Fixed several small bugs.
1480+
1481+
Wed Jun 11 08:30:41 CEST 2003
1482+
1483+
- Make sure a variable is no longer referenced when it is removed.
1484+
- Fixed counting bug in parsing "->" operator.
14801485
- Set ecpg version to 2.12.0.
14811486
- Set ecpg library to 3.4.2.
14821487
- Set pgtypes library to 1.0.0

src/interfaces/ecpg/preproc/preproc.y

Lines changed: 1 addition & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
/* $Header: /cvsroot/pgsql/src/interfaces/ecpg/preproc/Attic/preproc.y,v 1.229 2003/06/10 17:46:43 meskes Exp $ */
1+
/* $Header: /cvsroot/pgsql/src/interfaces/ecpg/preproc/Attic/preproc.y,v 1.230 2003/06/11 06:39:12 meskes Exp $ */
22

33
/* Copyright comment */
44
%{
@@ -48,14 +48,6 @@ static struct inf_compat_val
4848
struct inf_compat_val *next;
4949
} *informix_val;
5050

51-
void mm(void)
52-
{
53-
int i,j;
54-
55-
i=1;
56-
j=i+1;
57-
}
58-
5951
/*
6052
* Handle parsing errors and warnings
6153
*/
@@ -673,7 +665,6 @@ stmt: AlterDatabaseSetStmt { output_statement($1, 0, connection); }
673665
struct cursor *ptr;
674666
struct arguments *p;
675667

676-
mm();
677668
for (ptr = cur; ptr != NULL; ptr=ptr->next)
678669
{
679670
if (strcmp(ptr->name, $1) == 0)
@@ -2632,7 +2623,6 @@ DeclareCursorStmt: DECLARE name cursor_options CURSOR opt_hold FOR SelectStmt
26322623
this = (struct cursor *) mm_alloc(sizeof(struct cursor));
26332624

26342625
/* initial definition */
2635-
mm();
26362626
this->next = cur;
26372627
this->name = $2;
26382628
this->connection = connection;

src/interfaces/ecpg/preproc/variable.c

Lines changed: 32 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -137,7 +137,7 @@ find_struct(char *name, char *next, char *end)
137137
/* restore the name, we will need it later */
138138
*next = c;
139139

140-
return find_struct_member(name, end, p->type->u.element->u.members, p->brace_level);
140+
return find_struct_member(name, ++end, p->type->u.element->u.members, p->brace_level);
141141
}
142142
else
143143
{
@@ -260,6 +260,37 @@ remove_variables(int brace_level)
260260
{
261261
if (p->brace_level >= brace_level)
262262
{
263+
/* is it still referenced by a cursor? */
264+
struct cursor *ptr;
265+
266+
for (ptr = cur; ptr != NULL; ptr = ptr->next)
267+
{
268+
struct arguments *varptr, *prevvar;
269+
270+
for (varptr = prevvar = ptr->argsinsert; varptr != NULL; varptr = varptr->next)
271+
{
272+
if (p == varptr->variable)
273+
{
274+
/* remove from list */
275+
if (varptr == ptr->argsinsert)
276+
ptr->argsinsert = varptr->next;
277+
else
278+
prevvar->next = varptr->next;
279+
}
280+
}
281+
for (varptr = ptr->argsresult; varptr != NULL; varptr = varptr->next)
282+
{
283+
if (p == varptr->variable)
284+
{
285+
/* remove from list */
286+
if (varptr == ptr->argsresult)
287+
ptr->argsresult = varptr->next;
288+
else
289+
prevvar->next = varptr->next;
290+
}
291+
}
292+
}
293+
263294
/* remove it */
264295
if (p == allvariables)
265296
prev = allvariables = p->next;

0 commit comments

Comments
 (0)