aboutsummaryrefslogtreecommitdiff
path: root/src/interfaces/ecpg/preproc/variable.c
diff options
context:
space:
mode:
authorMichael Meskes <meskes@postgresql.org>2004-05-07 13:43:29 +0000
committerMichael Meskes <meskes@postgresql.org>2004-05-07 13:43:29 +0000
commit86ac85b6ae3f6c85be5a4810c35443b4f260007b (patch)
tree15016089a955de8e0f2e94d2bd8b88f097d60e55 /src/interfaces/ecpg/preproc/variable.c
parente6e814c2b16beababb0b9717f81e0103a6ac8984 (diff)
downloadpostgresql-86ac85b6ae3f6c85be5a4810c35443b4f260007b.tar.gz
postgresql-86ac85b6ae3f6c85be5a4810c35443b4f260007b.zip
- Fixed bug that reversed string length in typedefs.
Diffstat (limited to 'src/interfaces/ecpg/preproc/variable.c')
-rw-r--r--src/interfaces/ecpg/preproc/variable.c9
1 files changed, 6 insertions, 3 deletions
diff --git a/src/interfaces/ecpg/preproc/variable.c b/src/interfaces/ecpg/preproc/variable.c
index c4dfbb0f188..9663e29ef03 100644
--- a/src/interfaces/ecpg/preproc/variable.c
+++ b/src/interfaces/ecpg/preproc/variable.c
@@ -459,7 +459,7 @@ get_typedef(char *name)
}
void
-adjust_array(enum ECPGttype type_enum, char **dimension, char **length, char *type_dimension, char *type_index, int pointer_len)
+adjust_array(enum ECPGttype type_enum, char **dimension, char **length, char *type_dimension, char *type_index, int pointer_len, bool type_definition)
{
if (atoi(type_index) >= 0)
{
@@ -484,7 +484,6 @@ adjust_array(enum ECPGttype type_enum, char **dimension, char **length, char *ty
{
snprintf(errortext, sizeof(errortext), "No multilevel (more than 2) pointer supported %d", pointer_len);
mmerror(PARSE_ERROR, ET_FATAL, errortext);
-/* mmerror(PARSE_ERROR, ET_FATAL, "No multilevel (more than 2) pointer supported %d",pointer_len);*/
}
if (pointer_len > 1 && type_enum != ECPGt_char && type_enum != ECPGt_unsigned_char)
@@ -544,7 +543,11 @@ adjust_array(enum ECPGttype type_enum, char **dimension, char **length, char *ty
* make sure we return length = -1 for arrays without
* given bounds
*/
- if (atoi(*dimension) < 0)
+ if (atoi(*dimension) < 0 && !type_definition)
+ /*
+ * do not change this for typedefs
+ * since it will be changed later on when the variable is defined
+ */
*length = make_str("1");
else if (atoi(*dimension) == 0)
*length = make_str("-1");