Merge pull request #158 from Arkshine/fix-sizeof-fix

Improve more sizeof return on array without specifiying the dimensions
This commit is contained in:
Vincent Herbet 2014-11-11 21:09:44 +01:00
commit 0dd638d0fd

View File

@ -2264,17 +2264,17 @@ static void initials(int ident,int tag,cell *size,int dim[],int numdim,
* the same value; if so, we can store this * the same value; if so, we can store this
*/ */
constvalue *ld=lastdim.next; constvalue *ld=lastdim.next;
int d,match; int match;
for (d=0; d<dim[numdim-2]; d++) {
assert(ld!=NULL); assert(ld!=NULL);
assert(strtol(ld->name,NULL,16)==d); assert(strtol(ld->name,NULL,16)==0);
if (d==0)
match=ld->value; match=ld->value;
else if (match!=ld->value) while (ld->next) {
break;
ld=ld->next; ld=ld->next;
} /* for */ if (match!=ld->value) {
if (d==dim[numdim-2]) match=0;
break;
}
}
dim[numdim-1]=match; dim[numdim-1]=match;
} /* if */ } /* if */
/* after all arrays have been initalized, we know the (major) dimensions /* after all arrays have been initalized, we know the (major) dimensions