- detect empty array size for globals and initialize as pointer
This commit is contained in:
@@ -642,7 +642,23 @@ STATIC int8_t cfile_parser_evaluateExpression(char *aExpression, cfile_t *aCfile
|
|||||||
// contains array information if available "[10]"
|
// contains array information if available "[10]"
|
||||||
if (XREGEX_IS_MATCHGROUP(matchGroup, 3))
|
if (XREGEX_IS_MATCHGROUP(matchGroup, 3))
|
||||||
{
|
{
|
||||||
xmallocStrlcpy(&variable->array, &aExpression[matchGroup[3].rm_so], XREGEX_SIZEOF_MATCHGROUP(matchGroup, 3));
|
xmallocStrlcpy(&tempChar, &aExpression[matchGroup[3].rm_so], XREGEX_SIZEOF_MATCHGROUP(matchGroup, 3));
|
||||||
|
if (NULL != tempChar)
|
||||||
|
{
|
||||||
|
xStringTrim(tempChar, strlen(tempChar));
|
||||||
|
}
|
||||||
|
|
||||||
|
if (2 == strlen(tempChar))
|
||||||
|
{
|
||||||
|
// array without size definition
|
||||||
|
xmallocStrlcat(&variable->dataType, "*", 1);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
xmallocStrlcpy(&variable->array, tempChar, strlen(tempChar));
|
||||||
|
}
|
||||||
|
|
||||||
|
xfree((void**) &tempChar);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user