Skip to content

Commit ec7806d

Browse files
author
Michael Meskes
committed
Fixed bug in parsing of typedef'ed array sizes.
Synced parser.
1 parent b3f3092 commit ec7806d

File tree

4 files changed

+16
-15
lines changed

4 files changed

+16
-15
lines changed

src/interfaces/ecpg/ChangeLog

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1877,6 +1877,11 @@ Mon Oct 18 15:34:51 CEST 2004
18771877
Wed Nov 10 14:43:50 CET 2004
18781878

18791879
- List VALUE as a keyword.
1880+
1881+
Mon Dec 6 21:27:34 CET 2004
1882+
1883+
- Fixed bug in parsing of typedef'ed array sizes.
1884+
- Synced parser.
18801885
- Set ecpg version to 3.2.0.
18811886
- Set compat library version to 1.2.
18821887
- Set ecpg library version to 4.2.

src/interfaces/ecpg/preproc/preproc.y

Lines changed: 9 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
/* $PostgreSQL: pgsql/src/interfaces/ecpg/preproc/preproc.y,v 1.301 2004/11/10 13:48:10 meskes Exp $ */
1+
/* $PostgreSQL: pgsql/src/interfaces/ecpg/preproc/preproc.y,v 1.302 2004/12/06 20:35:35 meskes Exp $ */
22

33
/* Copyright comment */
44
%{
@@ -208,16 +208,16 @@ static char *
208208
adjust_informix(struct arguments *list)
209209
{
210210
/* Informix accepts DECLARE with variables that are out of scope when OPEN is called.
211-
* for instance you can declare variables in a function, and then subsequently use them
212-
* {
213-
* declare_vars();
214-
* exec sql ... which uses vars declared in the above function
215-
*
211+
* for instance you can declare variables in a function, and then subsequently use them
212+
* {
213+
* declare_vars();
214+
* exec sql ... which uses vars declared in the above function
215+
*
216216
* This breaks standard and leads to some very dangerous programming.
217217
* Since they do, we have to work around and accept their syntax as well.
218218
* But we will do so ONLY in Informix mode.
219219
* We have to change the variables to our own struct and just store the pointer instead of the variable
220-
*/
220+
*/
221221

222222
struct arguments *ptr;
223223
char *result = make_str("");
@@ -1955,12 +1955,8 @@ any_name: ColId { $$ = $1; }
19551955
| ColId attrs { $$ = cat2_str($1, $2); }
19561956
;
19571957

1958-
/*
1959-
* The slightly convoluted way of writing this production avoids reduce/reduce
1960-
* errors against indirection_el.
1961-
*/
19621958
attrs: '.' attr_name { $$ = cat2_str(make_str("."), $2); }
1963-
| '.' attr_name attrs { $$ = cat_str(3, make_str("."), $2, $3); }
1959+
| attrs '.' attr_name { $$ = cat_str(3, $1, make_str("."), $3); }
19641960
;
19651961

19661962
/*****************************************************************************
@@ -4167,7 +4163,7 @@ qualified_name_list: qualified_name
41674163

41684164
qualified_name: relation_name
41694165
{ $$ = $1; }
4170-
| relation_name attrs
4166+
| relation_name indirection
41714167
{ $$ = cat2_str($1, $2); }
41724168
;
41734169

src/interfaces/ecpg/preproc/type.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -365,7 +365,7 @@ ECPGdump_a_simple(FILE *o, const char *name, enum ECPGttype type,
365365
else
366366
sprintf(variable, "&(%s%s)", prefix ? prefix : "", name);
367367

368-
sprintf(offset, "%s*sizeof(char)", strcmp(varcharsize, "0") == 0 ? "1" : varcharsize);
368+
sprintf(offset, "(%s)*sizeof(char)", strcmp(varcharsize, "0") == 0 ? "1" : varcharsize);
369369
break;
370370
case ECPGt_numeric:
371371

src/interfaces/ecpg/preproc/variable.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -560,7 +560,7 @@ adjust_array(enum ECPGttype type_enum, char **dimension, char **length, char *ty
560560
* changed later on when the variable is defined
561561
*/
562562
*length = make_str("1");
563-
else if (atoi(*dimension) == 0)
563+
else if (strcmp(*dimension, "0") == 0)
564564
*length = make_str("-1");
565565
else
566566
*length = *dimension;

0 commit comments

Comments
 (0)
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy