CachedProperty: take string by value in ctor.
Test: mma
Change-Id: Ifcb32c204c4fbfe64fe91ff3b67822b1340fc42f
diff --git a/properties.cpp b/properties.cpp
index d925b10..7e30c82 100644
--- a/properties.cpp
+++ b/properties.cpp
@@ -221,8 +221,8 @@
return (WaitForPropertyCreation(key, relative_timeout, start_time) != nullptr);
}
-CachedProperty::CachedProperty(const char* property_name)
- : property_name_(property_name),
+CachedProperty::CachedProperty(std::string property_name)
+ : property_name_(std::move(property_name)),
prop_info_(nullptr),
cached_area_serial_(0),
cached_property_serial_(0),
@@ -231,6 +231,9 @@
static_assert(sizeof(cached_value_) == PROP_VALUE_MAX);
}
+CachedProperty::CachedProperty(const char* property_name)
+ : CachedProperty(std::string(property_name)) {}
+
const char* CachedProperty::Get(bool* changed) {
std::optional<uint32_t> initial_property_serial = cached_property_serial_;