aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAlex Vakulenko <avakulenko@google.com>2016-04-08 08:59:51 -0700
committerAlex Vakulenko <avakulenko@google.com>2016-04-08 09:58:57 -0700
commitbce6fbc44bcca5ae6dd6fdf36f08db835a45b2ab (patch)
treefdc9e22a0aa31556007e8da60ce1728c66398d49
parenta1d5f07e895c04002c9d57e620734f7ff98d1704 (diff)
downloadwebservd-bce6fbc44bcca5ae6dd6fdf36f08db835a45b2ab.tar.gz
webservd: Remove release/aquire semantic from scoped_ptr/unique_ptrandroid-n-preview-2
Now that scoped_ptr is just a type alias to unique_ptr, there is no longer a need to convert between the two by using .release() and constructing the other with a raw pointer. BUG: None TEST: Built for dragonboard, all unit tests pass (except for update_engine, but those tests failed before these changes too). Change-Id: I2ff27213f4e2f2121b25ca4d22eb556cea5d4254
-rw-r--r--webservd/config.cc15
1 files changed, 7 insertions, 8 deletions
diff --git a/webservd/config.cc b/webservd/config.cc
index f099049..62e512c 100644
--- a/webservd/config.cc
+++ b/webservd/config.cc
@@ -113,10 +113,8 @@ bool LoadConfigFromString(const std::string& config_json,
Config* config,
brillo::ErrorPtr* error) {
std::string error_msg;
- std::unique_ptr<const base::Value> value{
- base::JSONReader::ReadAndReturnError(
- config_json, base::JSON_ALLOW_TRAILING_COMMAS, nullptr, &error_msg)
- .release()};
+ auto value = base::JSONReader::ReadAndReturnError(
+ config_json, base::JSON_ALLOW_TRAILING_COMMAS, nullptr, &error_msg);
if (!value) {
brillo::Error::AddToPrintf(error, FROM_HERE,
@@ -127,8 +125,8 @@ bool LoadConfigFromString(const std::string& config_json,
return false;
}
- const base::DictionaryValue* dict_value = nullptr; // Owned by |value|
- if (!value->GetAsDictionary(&dict_value)) {
+ auto dict_value = base::DictionaryValue::From(std::move(value));
+ if (!dict_value) {
brillo::Error::AddTo(error,
FROM_HERE,
brillo::errors::json::kDomain,
@@ -140,10 +138,11 @@ bool LoadConfigFromString(const std::string& config_json,
// "log_directory" is optional, so ignoring the return value here.
dict_value->GetString(kLogDirectoryKey, &config->log_directory);
- const base::ListValue* protocol_handlers = nullptr; // Owned by |value|
+ const base::ListValue* protocol_handlers = nullptr; // Owned by |dict_value|
if (dict_value->GetList(kProtocolHandlersKey, &protocol_handlers)) {
for (base::Value* handler_value : *protocol_handlers) {
- const base::DictionaryValue* handler_dict = nullptr; // Owned by |value|
+ const base::DictionaryValue* handler_dict = nullptr; // Owned by
+ // |dict_value|
if (!handler_value->GetAsDictionary(&handler_dict)) {
brillo::Error::AddTo(
error,