summaryrefslogtreecommitdiffstats
path: root/fastboot/util.cpp
diff options
context:
space:
mode:
authorTom Cherry <tomcherry@google.com>2018-09-05 15:11:44 -0700
committerTom Cherry <tomcherry@google.com>2018-09-21 12:50:39 -0700
commit4aa60b382cf758ac366045b7d2efd3b2f68bd659 (patch)
tree74dd8d39c97c5f392eb32cdad56cb1de7019f111 /fastboot/util.cpp
parentdfd85df11ace52e8b7076591e3e31dc087467f01 (diff)
downloadsystem_core-4aa60b382cf758ac366045b7d2efd3b2f68bd659.tar.gz
system_core-4aa60b382cf758ac366045b7d2efd3b2f68bd659.tar.bz2
system_core-4aa60b382cf758ac366045b7d2efd3b2f68bd659.zip
fastboot: clean up CheckRequirements
CheckRequirements() had various issues that are cleaned up here, 1) Move from C string parsing to C++ 2) Moved from C data structures to C++, including fixing memory leaks. 3) Removed the 'cur_product' global and the 'query_save' function that stores it 4) Actually writing tests for the parsing function for android-info.txt 5) Check that a variable needs to be checked for a given product before trying to read it. Previously, fastboot would fail if a variable isn't recognized on a device, even if the check should be ignored. A lot of flexibility is allowed for the input strings, to keep backwards compatibility with the previous parsers. Test: fastboot works, unit tests Change-Id: Idc3bba8b8fe829d8eefe5f6c495e63a9441c0b60
Diffstat (limited to 'fastboot/util.cpp')
-rw-r--r--fastboot/util.cpp6
1 files changed, 0 insertions, 6 deletions
diff --git a/fastboot/util.cpp b/fastboot/util.cpp
index 125182d73..7d15047ff 100644
--- a/fastboot/util.cpp
+++ b/fastboot/util.cpp
@@ -74,9 +74,3 @@ void Status(const std::string& message) {
static constexpr char kStatusFormat[] = "%-50s ";
fprintf(stderr, kStatusFormat, message.c_str());
}
-
-char* xstrdup(const char* s) {
- char* result = strdup(s);
- if (!result) die("out of memory");
- return result;
-}