From 59dcb9cbea8fb70ab933fd10d35582b08cd13f37 Mon Sep 17 00:00:00 2001 From: Tao Bao Date: Mon, 3 Oct 2016 18:06:46 -0700 Subject: edify: Move State.script and State.errmsg to std::string. This way we kill a few strdup() and free() calls. Test: 1. recovery_component_test still passes; 2. Applying an update with the new updater works; 3. The error code in a script with abort("E310: xyz") is recorded into last_install correctly. Change-Id: Ibda4da5937346e058a0d7cc81764d6f02920010a --- tests/component/edify_test.cpp | 7 +------ 1 file changed, 1 insertion(+), 6 deletions(-) (limited to 'tests/component') diff --git a/tests/component/edify_test.cpp b/tests/component/edify_test.cpp index ded8540a0..ede2ecb0a 100644 --- a/tests/component/edify_test.cpp +++ b/tests/component/edify_test.cpp @@ -25,10 +25,7 @@ static void expect(const char* expr_str, const char* expected) { int error_count; EXPECT_EQ(parse_string(expr_str, &e, &error_count), 0); - State state; - state.cookie = nullptr; - state.errmsg = nullptr; - state.script = strdup(expr_str); + State state(expr_str, nullptr); char* result = Evaluate(&state, e); @@ -38,8 +35,6 @@ static void expect(const char* expr_str, const char* expected) { EXPECT_STREQ(result, expected); } - free(state.errmsg); - free(state.script); free(result); } -- cgit v1.2.3