summaryrefslogtreecommitdiffstats
path: root/edify/parser.y
diff options
context:
space:
mode:
authorTao Bao <tbao@google.com>2015-08-20 21:10:46 +0200
committerTao Bao <tbao@google.com>2015-08-20 21:11:04 +0200
commit2a5a49d3376eae890d76bb560e0d8ffc264ff5a6 (patch)
tree2aa9d806b2c6f235ea79780f6f5452927fd80df7 /edify/parser.y
parentMerge "Fix potential crash" (diff)
downloadandroid_bootable_recovery-2a5a49d3376eae890d76bb560e0d8ffc264ff5a6.tar
android_bootable_recovery-2a5a49d3376eae890d76bb560e0d8ffc264ff5a6.tar.gz
android_bootable_recovery-2a5a49d3376eae890d76bb560e0d8ffc264ff5a6.tar.bz2
android_bootable_recovery-2a5a49d3376eae890d76bb560e0d8ffc264ff5a6.tar.lz
android_bootable_recovery-2a5a49d3376eae890d76bb560e0d8ffc264ff5a6.tar.xz
android_bootable_recovery-2a5a49d3376eae890d76bb560e0d8ffc264ff5a6.tar.zst
android_bootable_recovery-2a5a49d3376eae890d76bb560e0d8ffc264ff5a6.zip
Diffstat (limited to 'edify/parser.y')
-rw-r--r--edify/parser.y8
1 files changed, 4 insertions, 4 deletions
diff --git a/edify/parser.y b/edify/parser.y
index f8fb2d12f..098a6370a 100644
--- a/edify/parser.y
+++ b/edify/parser.y
@@ -70,7 +70,7 @@ input: expr { *root = $1; }
;
expr: STRING {
- $$ = malloc(sizeof(Expr));
+ $$ = reinterpret_cast<Expr*>(malloc(sizeof(Expr)));
$$->fn = Literal;
$$->name = $1;
$$->argc = 0;
@@ -91,7 +91,7 @@ expr: STRING {
| IF expr THEN expr ENDIF { $$ = Build(IfElseFn, @$, 2, $2, $4); }
| IF expr THEN expr ELSE expr ENDIF { $$ = Build(IfElseFn, @$, 3, $2, $4, $6); }
| STRING '(' arglist ')' {
- $$ = malloc(sizeof(Expr));
+ $$ = reinterpret_cast<Expr*>(malloc(sizeof(Expr)));
$$->fn = FindFunction($1);
if ($$->fn == NULL) {
char buffer[256];
@@ -113,12 +113,12 @@ arglist: /* empty */ {
}
| expr {
$$.argc = 1;
- $$.argv = malloc(sizeof(Expr*));
+ $$.argv = reinterpret_cast<Expr**>(malloc(sizeof(Expr*)));
$$.argv[0] = $1;
}
| arglist ',' expr {
$$.argc = $1.argc + 1;
- $$.argv = realloc($$.argv, $$.argc * sizeof(Expr*));
+ $$.argv = reinterpret_cast<Expr**>(realloc($$.argv, $$.argc * sizeof(Expr*)));
$$.argv[$$.argc-1] = $3;
}
;