diff options
author | Tom Cherry <tomcherry@google.com> | 2017-04-24 16:47:18 -0700 |
---|---|---|
committer | Tom Cherry <tomcherry@google.com> | 2017-04-25 11:24:33 -0700 |
commit | ad6741c6f82febee62bbfc439d03654c2cb3ba3e (patch) | |
tree | c39a1d0ac4f41f4add55a3fcc7e7a1a9040a3a76 | |
parent | fe062055cb11fcb1a6178b046173fc0361ad5b96 (diff) | |
download | core-ad6741c6f82febee62bbfc439d03654c2cb3ba3e.tar.gz core-ad6741c6f82febee62bbfc439d03654c2cb3ba3e.tar.bz2 core-ad6741c6f82febee62bbfc439d03654c2cb3ba3e.zip |
init: remove unused parts of parser.cpp
Now that ueventd is using init's parser, we no longer need anything
other than the tokenizer from parser.cpp.
Test: Boot bullhead
Change-Id: I1f70f2c4479af576174bd74dd919d81817500216
-rw-r--r-- | init/init_parser.cpp | 10 | ||||
-rw-r--r-- | init/parser.cpp | 23 | ||||
-rw-r--r-- | init/parser.h | 6 |
3 files changed, 4 insertions, 35 deletions
diff --git a/init/init_parser.cpp b/init/init_parser.cpp index c8ef8d9e6..620367a62 100644 --- a/init/init_parser.cpp +++ b/init/init_parser.cpp @@ -48,7 +48,6 @@ void Parser::ParseData(const std::string& filename, const std::string& data) { data_copy.push_back('\0'); parse_state state; - state.filename = filename.c_str(); state.line = 0; state.ptr = &data_copy[0]; state.nexttoken = 0; @@ -76,7 +75,7 @@ void Parser::ParseData(const std::string& filename, const std::string& data) { std::string ret_err; if (!callback(std::move(args), &ret_err)) { - parse_error(&state, "%s\n", ret_err.c_str()); + LOG(ERROR) << filename << ": " << state.line << ": " << ret_err; } section_parser = nullptr; break; @@ -88,15 +87,14 @@ void Parser::ParseData(const std::string& filename, const std::string& data) { } section_parser = section_parsers_[args[0]].get(); std::string ret_err; - if (!section_parser->ParseSection(std::move(args), state.filename, state.line, - &ret_err)) { - parse_error(&state, "%s\n", ret_err.c_str()); + if (!section_parser->ParseSection(std::move(args), filename, state.line, &ret_err)) { + LOG(ERROR) << filename << ": " << state.line << ": " << ret_err; section_parser = nullptr; } } else if (section_parser) { std::string ret_err; if (!section_parser->ParseLineSection(std::move(args), state.line, &ret_err)) { - parse_error(&state, "%s\n", ret_err.c_str()); + LOG(ERROR) << filename << ": " << state.line << ": " << ret_err; } } args.clear(); diff --git a/init/parser.cpp b/init/parser.cpp index 5953a8867..0d13cfea9 100644 --- a/init/parser.cpp +++ b/init/parser.cpp @@ -1,28 +1,5 @@ #include "parser.h" -#include <stdarg.h> -#include <stdio.h> -#include <string.h> - -#include <android-base/logging.h> - -void parse_error(struct parse_state *state, const char *fmt, ...) -{ - va_list ap; - char buf[128]; - int off; - - snprintf(buf, sizeof(buf), "%s: %d: ", state->filename, state->line); - buf[127] = 0; - off = strlen(buf); - - va_start(ap, fmt); - vsnprintf(buf + off, 128 - off, fmt, ap); - va_end(ap); - buf[127] = 0; - LOG(ERROR) << buf; -} - int next_token(struct parse_state *state) { char *x = state->ptr; diff --git a/init/parser.h b/init/parser.h index 95e1164fe..3dcc566c1 100644 --- a/init/parser.h +++ b/init/parser.h @@ -27,14 +27,8 @@ struct parse_state char *text; int line; int nexttoken; - void *context; - void (*parse_line)(struct parse_state *state, int nargs, char **args); - const char *filename; - void *priv; }; -void dump_parser_state(void); int next_token(struct parse_state *state); -void parse_error(struct parse_state *state, const char *fmt, ...); #endif /* PARSER_H_ */ |