summaryrefslogtreecommitdiffstats
path: root/edify/parser.y
diff options
context:
space:
mode:
authorTao Bao <tbao@google.com>2015-08-21 20:20:17 +0200
committerAndroid Git Automerger <android-git-automerger@android.com>2015-08-21 20:20:17 +0200
commit822685a8648e91aca6ce35992087c18165d4d609 (patch)
tree41f6eaada8de57f11eabd573f351490d1abe9f52 /edify/parser.y
parentam 4854e292: am ad509fd4: Merge "Fix potential crash" (diff)
parentam 93fa4b67: Merge "edify: Switch to C++." (diff)
downloadandroid_bootable_recovery-822685a8648e91aca6ce35992087c18165d4d609.tar
android_bootable_recovery-822685a8648e91aca6ce35992087c18165d4d609.tar.gz
android_bootable_recovery-822685a8648e91aca6ce35992087c18165d4d609.tar.bz2
android_bootable_recovery-822685a8648e91aca6ce35992087c18165d4d609.tar.lz
android_bootable_recovery-822685a8648e91aca6ce35992087c18165d4d609.tar.xz
android_bootable_recovery-822685a8648e91aca6ce35992087c18165d4d609.tar.zst
android_bootable_recovery-822685a8648e91aca6ce35992087c18165d4d609.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;
}
;