Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(4623)

Unified Diff: chrome/browser/chromeos/system/syslogs_provider.cc

Issue 149573004: Cleanup: Remove std::string("") usage. (Closed) Base URL: svn://chrome-svn/chrome/trunk/src/
Patch Set: Created 6 years, 11 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « ash/display/display_manager.cc ('k') | chromeos/network/network_configuration_handler_unittest.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/browser/chromeos/system/syslogs_provider.cc
===================================================================
--- chrome/browser/chromeos/system/syslogs_provider.cc (revision 247534)
+++ chrome/browser/chromeos/system/syslogs_provider.cc (working copy)
@@ -51,17 +51,17 @@
// Reads a key from the input string erasing the read values + delimiters read
// from the initial string
std::string ReadKey(std::string* data) {
+ std::string key;
size_t equal_sign = data->find("=");
if (equal_sign == std::string::npos)
- return std::string("");
- std::string key = data->substr(0, equal_sign);
+ return key;
+ key = data->substr(0, equal_sign);
data->erase(0, equal_sign);
- if (data->size() > 0) {
- // erase the equal to sign also
- data->erase(0,1);
+ if (data->empty())
return key;
- }
- return std::string();
+ // erase the equal to sign also
+ data->erase(0, 1);
+ return key;
}
// Reads a value from the input string; erasing the read values from
@@ -93,7 +93,8 @@
std::string value = data->substr(0, next_multi);
data->erase(0, next_multi + 3);
return value;
- } else { // single line value
+ } else {
+ // single line value
size_t endl_pos = data->find_first_of(kNewLineChars);
// if we don't find a new line, we just return the rest of the data
std::string value = data->substr(0, endl_pos);
« no previous file with comments | « ash/display/display_manager.cc ('k') | chromeos/network/network_configuration_handler_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698