Fix AnimationParser remove_prefix test
The test fails because TEST_STRING, a char[], is silently
converted to a std::string, passed to remove_prefix, then
the string is destroyed, but a pointer to the string is
returned.
Fix it by changing the signature of remove_prefix to use
std::string_view to be more robust in handling raw char*.
Test: run it
Change-Id: I553c066907f09cf330c8b7a4659db5a1fee82cac
diff --git a/healthd/AnimationParser.cpp b/healthd/AnimationParser.cpp
index fde3b95..6b08570 100644
--- a/healthd/AnimationParser.cpp
+++ b/healthd/AnimationParser.cpp
@@ -37,8 +37,8 @@
return true;
}
-bool remove_prefix(const std::string& line, const char* prefix, const char** rest) {
- const char* str = line.c_str();
+bool remove_prefix(std::string_view line, const char* prefix, const char** rest) {
+ const char* str = line.data();
int start;
char c;