Avoid big statics.
Allocating big statics when needed.
Bug: 150319735
Test: boot/works
Change-Id: I5dde4f473b38be8e8d99f034227abaedb3e50634
diff --git a/KernelConfigParser.cpp b/KernelConfigParser.cpp
index 5713f22..c851716 100644
--- a/KernelConfigParser.cpp
+++ b/KernelConfigParser.cpp
@@ -21,10 +21,6 @@
#define KEY "(CONFIG[\\w_]+)"
#define COMMENT "(?:#.*)"
-static const std::regex sKeyValuePattern("^\\s*" KEY "\\s*=\\s*([^#]+)" COMMENT "?$");
-static const std::regex sNotSetPattern("^\\s*#\\s*" KEY " is not set\\s*$");
-static const std::regex sCommentPattern("^\\s*" COMMENT "$");
-
namespace android {
namespace vintf {
@@ -56,11 +52,14 @@
}
status_t KernelConfigParser::processRemaining() {
-
if (mRemaining.empty()) {
return OK;
}
+ static const std::regex sKeyValuePattern("^\\s*" KEY "\\s*=\\s*([^#]+)" COMMENT "?$");
+ static const std::regex sNotSetPattern("^\\s*#\\s*" KEY " is not set\\s*$");
+ static const std::regex sCommentPattern("^\\s*" COMMENT "$");
+
std::smatch match;
if (mRelaxedFormat) {