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

Unified Diff: src/common/chromeos/string.cc

Issue 460001: Clean up to move NewStringCopy from util to chromoes/string. (Closed)
Patch Set: Removed pw file, changed include format Created 11 years 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 | « src/common/chromeos/string.h ('k') | src/common/util.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/common/chromeos/string.cc
diff --git a/src/common/chromeos/string.cc b/src/common/chromeos/string.cc
index f447f85668d2f509212fa3b323bbcef793c0d179..c70e0656cca2cc4819c7cb40e6d8da9207036c1f 100644
--- a/src/common/chromeos/string.cc
+++ b/src/common/chromeos/string.cc
@@ -4,8 +4,9 @@
#include <chromeos/string.h>
-#include <pcrecpp.h>
+#include <cstring>
+#include <pcrecpp.h>
#include "base/logging.h"
namespace chromeos {
@@ -45,5 +46,11 @@ void SplitStringUsing(const std::string& str,
}
}
+char* NewStringCopy(const char* x) {
+ char* result = static_cast<char*>(::operator new(std::strlen(x) + 1));
+ std::strcpy(result, x); // NOLINT
+ return result;
+}
+
} // namespace chromeos
« no previous file with comments | « src/common/chromeos/string.h ('k') | src/common/util.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698