summaryrefslogtreecommitdiffstats
path: root/edify/parser.y
diff options
context:
space:
mode:
authorTao Bao <tbao@google.com>2015-08-21 19:36:11 +0200
committerGerrit Code Review <noreply-gerritcodereview@google.com>2015-08-21 19:36:11 +0200
commit93fa4b677cac9288e936915f15ca8e5f76a4e4b6 (patch)
tree2aa9d806b2c6f235ea79780f6f5452927fd80df7 /edify/parser.y
parentMerge "Fix potential crash" (diff)
parentedify: Switch to C++. (diff)
downloadandroid_bootable_recovery-93fa4b677cac9288e936915f15ca8e5f76a4e4b6.tar
android_bootable_recovery-93fa4b677cac9288e936915f15ca8e5f76a4e4b6.tar.gz
android_bootable_recovery-93fa4b677cac9288e936915f15ca8e5f76a4e4b6.tar.bz2
android_bootable_recovery-93fa4b677cac9288e936915f15ca8e5f76a4e4b6.tar.lz
android_bootable_recovery-93fa4b677cac9288e936915f15ca8e5f76a4e4b6.tar.xz
android_bootable_recovery-93fa4b677cac9288e936915f15ca8e5f76a4e4b6.tar.zst
android_bootable_recovery-93fa4b677cac9288e936915f15ca8e5f76a4e4b6.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;
}
;