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

Unified Diff: base/string_split.cc

Issue 10684003: Make SplitString() and variants clear their outparam vector. (Note that SplitStringIntoKeyValues()… (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src/
Patch Set: Created 8 years, 6 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 | « base/string_split.h ('k') | base/string_split_unittest.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: base/string_split.cc
===================================================================
--- base/string_split.cc (revision 144240)
+++ base/string_split.cc (working copy)
@@ -16,6 +16,7 @@
const typename STR::value_type s,
bool trim_whitespace,
std::vector<STR>* r) {
+ r->clear();
size_t last = 0;
size_t c = str.size();
for (size_t i = 0; i <= c; ++i) {
@@ -115,6 +116,7 @@
static void SplitStringUsingSubstrT(const STR& str,
const STR& s,
std::vector<STR>* r) {
+ r->clear();
typename STR::size_type begin_index = 0;
while (true) {
const typename STR::size_type end_index = str.find(s, begin_index);
@@ -165,6 +167,7 @@
template<typename STR>
void SplitStringAlongWhitespaceT(const STR& str, std::vector<STR>* result) {
+ result->clear();
const size_t length = str.length();
if (!length)
return;
« no previous file with comments | « base/string_split.h ('k') | base/string_split_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698