From d8be5b9eef951edcd88af05a6800d46fffed9582 Mon Sep 17 00:00:00 2001 From: johanknol Date: Sat, 4 Jan 2003 17:24:58 +0000 Subject: [PATCH] fixed the initialized array of structures git-svn-id: https://sdcc.svn.sourceforge.net/svnroot/sdcc/trunk/sdcc@2134 4a8a32a2-be11-0410-ad9d-d568d2c75423 --- ChangeLog | 4 ++++ src/SDCCval.c | 6 ++---- 2 files changed, 6 insertions(+), 4 deletions(-) diff --git a/ChangeLog b/ChangeLog index 9d97e0af..802e7814 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,7 @@ +2003-01-04 + + * src/SDCCval.c (getNelements): fixed the initialized array of structures + 2002-12-29 Jesus Calvino-Fraga * as/mcs51/Makefile.bcc: fixed typo lkomf51.o -> lkaomf51.o diff --git a/src/SDCCval.c b/src/SDCCval.c index 72c73a18..d893ccba 100644 --- a/src/SDCCval.c +++ b/src/SDCCval.c @@ -1457,18 +1457,17 @@ valCastLiteral (sym_link * dtype, double fval) int getNelements (sym_link * type, initList * ilist) { - sym_link *etype = getSpec (type); int i; if (!ilist) return 0; - while (ilist->type == INIT_DEEP) + if (ilist->type == INIT_DEEP) ilist = ilist->init.deep; /* if type is a character array and there is only one (string) initialiser then get the length of the string */ - if (IS_ARRAY (type) && IS_CHAR (etype) && !ilist->next) + if (IS_ARRAY (type) && IS_CHAR (type->next) && !ilist->next) { ast *iast = ilist->init.node; value *v = (iast->type == EX_VALUE ? iast->opval.val : NULL); @@ -1491,7 +1490,6 @@ getNelements (sym_link * type, initList * ilist) i++; ilist = ilist->next; } - return i; } -- 2.47.2