{
initList *nilist;
-
nilist = Safe_alloc (sizeof (initList));
nilist->type = type;
}
/*------------------------------------------------------------------*/
-/* revinit - reverses the initial values for a value chain */
+/* revinit - reverses the initial values for a value chain */
/*------------------------------------------------------------------*/
initList *
revinit (initList * val)
}
bool
-convertIListToConstList(initList *src, literalList **lList)
+convertIListToConstList(initList *src, literalList **lList, int size)
{
+ int cnt = 0;
initList *iLoop;
literalList *head, *last, *newL;
head = last = NULL;
- if (!src || src->type != INIT_DEEP)
+ if (src && src->type != INIT_DEEP)
{
return FALSE;
}
- iLoop = src->init.deep;
+ iLoop = src ? src->init.deep : NULL;
while (iLoop)
{
return FALSE;
}
iLoop = iLoop->next;
+ cnt++;
+ }
+ if (!size)
+ {
+ size = cnt;
}
/* We've now established that the initializer list contains only literal values. */
- iLoop = src->init.deep;
- while (iLoop)
+ iLoop = src ? src->init.deep : NULL;
+ while (size--)
{
- double val = AST_FLOAT_VALUE(iLoop->init.node);
+ double val = iLoop ? AST_FLOAT_VALUE(iLoop->init.node) : 0;
if (last && last->literalValue == val)
{
}
last = newL;
}
- iLoop = iLoop->next;
+ iLoop = iLoop ? iLoop->next : NULL;
}
if (!head)
/*------------------------------------------------------------------*/
-/* copyIlist - copy initializer list */
+/* copyIlist - copy initializer list */
/*------------------------------------------------------------------*/
initList *
copyIlist (initList * src)
ast *
list2expr (initList * ilist)
{
+ if (!ilist)
+ return NULL;
if (ilist->type == INIT_DEEP)
return list2expr (ilist->init.deep);
return ilist->init.node;
if (IS_FLOAT (val->type))
SPEC_CVAL (val->type).v_float = floatFromVal (lval) / floatFromVal (rval);
- else
- if (IS_FIXED16X16 (val->type))
+ else if (IS_FIXED16X16 (val->type))
SPEC_CVAL (val->type).v_fixed16x16 = fixed16x16FromDouble( floatFromVal (lval) / floatFromVal (rval) );
else if (SPEC_LONG (val->type))
{