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

Issue 502074: Move two generic string split functions from sync API to their own API in bas... (Closed)

Created:
11 years ago by tim (not reviewing)
Modified:
9 years, 6 months ago
Reviewers:
tfarina, Denis Lagno
CC:
chromium-reviews, brettw+cc_chromium.org, ncarter (slow), idana, ben+cc_chromium.org, Paweł Hajdan Jr., darin (slow to review), tim (not reviewing)
Visibility:
Public.

Description

Move two generic string split functions from sync API to their own API in base/string_split. BUG=None TEST=base_unittests Original patch by Thiago Farina Original Review: http://codereview.chromium.org/464075 Committed: http://src.chromium.org/viewvc/chrome?view=rev&revision=36774

Patch Set 1 #

Patch Set 2 : '' #

Patch Set 3 : '' #

Patch Set 4 : '' #

Patch Set 5 : '' #

Total comments: 1
Unified diffs Side-by-side diffs Delta from patch set Stats (+224 lines, -61 lines) Patch
M base/base.gyp View 1 2 3 1 chunk +1 line, -0 lines 0 comments Download
M base/base.gypi View 1 2 3 1 chunk +2 lines, -0 lines 0 comments Download
A base/string_split.h View 1 2 3 4 1 chunk +27 lines, -0 lines 1 comment Download
A base/string_split.cc View 1 2 3 4 1 chunk +68 lines, -0 lines 0 comments Download
A base/string_split_unittest.cc View 1 2 3 4 1 chunk +120 lines, -0 lines 0 comments Download
M base/string_util.h View 1 2 3 1 chunk +2 lines, -0 lines 0 comments Download
M chrome/browser/sync/engine/net/gaia_authenticator.cc View 1 2 3 5 chunks +4 lines, -61 lines 0 comments Download

Messages

Total messages: 3 (0 generated)
tfarina (gmail-do not use)
Tim, if something failed on the trybots, please send me a email, then I can ...
11 years ago (2009-12-23 18:40:41 UTC) #1
tfarina (gmail-do not use)
Tim do you will land this patch?
10 years, 11 months ago (2010-01-15 15:01:56 UTC) #2
Denis Lagno
9 years, 9 months ago (2011-03-24 15:49:19 UTC) #3
http://codereview.chromium.org/502074/diff/12001/base/string_split.h
File base/string_split.h (right):

http://codereview.chromium.org/502074/diff/12001/base/string_split.h#newcode17
base/string_split.h:17: std::string* key, std::vector<std::string>* values);
I have concerns about these
First problem is its weird signature:

bool SplitStringIntoKeyValues(
    const std::string& line,
    char key_value_delimiter,
    std::string* key, std::vector<std::string>* values);

contrary to this signature function splits string into single key and single
value.  Probably sometime emptiness of output vector served as error code but
now it has separate error return value.
Ok, that's easy to fix.  But there are other problems:

It accepts empty keys while rejects empty values.  For me it sounds weird: empty
values are common and normal but empty key usually means that something is
broken.
How it handles multiple delimiters like in "key===value=" -- it splits it as
"key" and "value=" -- this looks not great, I prefer "key" and "==value="
because it does not place unnecessary restriction (do not start with delimiter)
on value strings.  And BTW it does not check multiple delimiters in unittests:)

Currently those functions are used only in gaia auth, so I fear to break
something by changing it but in its current form I doubt this split string
functionality is usable by general public (as implied by its presence in base::)

Powered by Google App Engine
This is Rietveld 408576698