fixed the initialized array of structures
authorjohanknol <johanknol@4a8a32a2-be11-0410-ad9d-d568d2c75423>
Sat, 4 Jan 2003 17:24:58 +0000 (17:24 +0000)
committerjohanknol <johanknol@4a8a32a2-be11-0410-ad9d-d568d2c75423>
Sat, 4 Jan 2003 17:24:58 +0000 (17:24 +0000)
git-svn-id: https://sdcc.svn.sourceforge.net/svnroot/sdcc/trunk/sdcc@2134 4a8a32a2-be11-0410-ad9d-d568d2c75423

ChangeLog
src/SDCCval.c

index 9d97e0afa10ee0a1d409ef4b1f2b67d966672a21..802e7814afbd4be0bb547d68167d2eae9ec78c77 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,7 @@
+2003-01-04    <johan@balder>
+
+       * src/SDCCval.c (getNelements): fixed the initialized array of structures
+
 2002-12-29  Jesus Calvino-Fraga <jesusc@ece.ubc.ca>
         * as/mcs51/Makefile.bcc: fixed typo lkomf51.o -> lkaomf51.o
 
index 72c73a1888cc1d7e21dc2dfc1ed413326f2686c6..d893ccba608a3a902fbe64b934858e0cd78eb62e 100644 (file)
@@ -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;
 }