summaryrefslogtreecommitdiffstats
path: root/edify/expr.h
diff options
context:
space:
mode:
authorTao Bao <tbao@google.com>2016-10-04 03:06:46 +0200
committerTao Bao <tbao@google.com>2016-10-05 00:33:22 +0200
commit876b9391c084701b147af3b0d5c933d877bb6052 (patch)
tree603d90593492fb898a8f76824192aaa03630c614 /edify/expr.h
parentMerge "recovery: drop log/logger.h" am: 38b923ff6c am: 7cf7e6ce4f am: 0467a905cc (diff)
downloadandroid_bootable_recovery-876b9391c084701b147af3b0d5c933d877bb6052.tar
android_bootable_recovery-876b9391c084701b147af3b0d5c933d877bb6052.tar.gz
android_bootable_recovery-876b9391c084701b147af3b0d5c933d877bb6052.tar.bz2
android_bootable_recovery-876b9391c084701b147af3b0d5c933d877bb6052.tar.lz
android_bootable_recovery-876b9391c084701b147af3b0d5c933d877bb6052.tar.xz
android_bootable_recovery-876b9391c084701b147af3b0d5c933d877bb6052.tar.zst
android_bootable_recovery-876b9391c084701b147af3b0d5c933d877bb6052.zip
Diffstat (limited to 'edify/expr.h')
-rw-r--r--edify/expr.h22
1 files changed, 11 insertions, 11 deletions
diff --git a/edify/expr.h b/edify/expr.h
index 886347991..f045d9386 100644
--- a/edify/expr.h
+++ b/edify/expr.h
@@ -18,6 +18,7 @@
#define _EXPRESSION_H
#include <unistd.h>
+#include <string>
#include "error_code.h"
#include "yydefs.h"
@@ -26,20 +27,20 @@
typedef struct Expr Expr;
-typedef struct {
+struct State {
+ State(const std::string& script, void* cookie);
+
+ // The source of the original script.
+ const std::string& script;
+
// Optional pointer to app-specific data; the core of edify never
// uses this value.
void* cookie;
- // The source of the original script. Must be NULL-terminated,
- // and in writable memory (Evaluate may make temporary changes to
- // it but will restore it when done).
- char* script;
-
// The error message (if any) returned if the evaluation aborts.
- // Should be NULL initially, will be either NULL or a malloc'd
- // pointer after Evaluate() returns.
- char* errmsg;
+ // Should be empty initially, will be either empty or a string that
+ // Evaluate() returns.
+ std::string errmsg;
// error code indicates the type of failure (e.g. failure to update system image)
// during the OTA process.
@@ -50,8 +51,7 @@ typedef struct {
CauseCode cause_code = kNoCause;
bool is_retry = false;
-
-} State;
+};
#define VAL_STRING 1 // data will be NULL-terminated; size doesn't count null
#define VAL_BLOB 2