diff options
author | Alex Vakulenko <avakulenko@google.com> | 2016-04-08 18:17:28 +0000 |
---|---|---|
committer | android-build-merger <android-build-merger@google.com> | 2016-04-08 18:17:28 +0000 |
commit | d0b36f50d87757a229ce07b483966019ebb2458d (patch) | |
tree | fdc9e22a0aa31556007e8da60ce1728c66398d49 | |
parent | a1d5f07e895c04002c9d57e620734f7ff98d1704 (diff) | |
parent | bce6fbc44bcca5ae6dd6fdf36f08db835a45b2ab (diff) | |
download | webservd-d0b36f50d87757a229ce07b483966019ebb2458d.tar.gz |
webservd: Remove release/aquire semantic from scoped_ptr/unique_ptr
am: bce6fbc
* commit 'bce6fbc44bcca5ae6dd6fdf36f08db835a45b2ab':
webservd: Remove release/aquire semantic from scoped_ptr/unique_ptr
Change-Id: I73524c07807fc27a296dbc06c8141db360b3fa4f
-rw-r--r-- | webservd/config.cc | 15 |
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, |