-
Notifications
You must be signed in to change notification settings - Fork 0
Open
Description
Looking through the grammar at https://github.com/LilyOSullivan/SymbolicExecutionForCWithParser/blob/main/LexYacc/Parser_source/GRAMMAR.Y I noticed that there are several actions that can be removed and achieve the same result with less work/allocations:
{
$$ = (char*) malloc(strlen($1) + 1);
strcpy($$, $1);
free($1);
}
Rule actions like the above can be removed, because the default rule is $$ = $1, so no need to copy and delete $1.
{
struct_flag = NO;
// Visual C extension
$$ = (char*) malloc(strlen($2) + 1);
strcpy($$, $2);
free($1);
free($2);
}
Rule actions like the above can be reduced to :
{
struct_flag = NO;
// Visual C extension
$$ = $2;
free($1);
}
Metadata
Metadata
Assignees
Labels
No labels