Commit b5a613c4 authored by msaboff@apple.com's avatar msaboff@apple.com

String::split(UChar, Vector<String>&) shouldn't create a temporary String

https://bugs.webkit.org/show_bug.cgi?id=100578

Reviewed by Anders Carlsson.

Changed split(UChar, Vector<String>&) to call split(UChar, bool, Vector<String>&) instead of creating a
string and calling the split(String,...) version and moved it to WTFString.h.  Also moved
split(const String& separator, Vector<String>& result) to WTFString.h.

* wtf/text/WTFString.cpp:
(WTF::String::split):
* wtf/text/WTFString.h:
(WTF::String::split):


git-svn-id: http://svn.webkit.org/repository/webkit/trunk@132828 268f45cc-cd09-0410-ab3c-d52691b4dbfc
parent 23cc78e6
2012-10-29 Michael Saboff <msaboff@apple.com>
String::split(UChar, Vector<String>&) shouldn't create a temporary String
https://bugs.webkit.org/show_bug.cgi?id=100578
Reviewed by Anders Carlsson.
Changed split(UChar, Vector<String>&) to call split(UChar, bool, Vector<String>&) instead of creating a
string and calling the split(String,...) version and moved it to WTFString.h. Also moved
split(const String& separator, Vector<String>& result) to WTFString.h.
* wtf/text/WTFString.cpp:
(WTF::String::split):
* wtf/text/WTFString.h:
(WTF::String::split):
2012-10-29 Sheriff Bot <webkit.review.bot@gmail.com>
Unreviewed, rolling out r132736.
......
......@@ -665,11 +665,6 @@ void String::split(const String& separator, bool allowEmptyEntries, Vector<Strin
result.append(substring(startPos));
}
void String::split(const String& separator, Vector<String>& result) const
{
split(separator, false, result);
}
void String::split(UChar separator, bool allowEmptyEntries, Vector<String>& result) const
{
result.clear();
......@@ -685,11 +680,6 @@ void String::split(UChar separator, bool allowEmptyEntries, Vector<String>& resu
result.append(substring(startPos));
}
void String::split(UChar separator, Vector<String>& result) const
{
split(String(&separator, 1), false, result);
}
CString String::ascii() const
{
// Printable ASCII characters 32..127 and the null character are
......
......@@ -350,10 +350,16 @@ public:
static String createUninitialized(unsigned length, UChar*& data) { return StringImpl::createUninitialized(length, data); }
static String createUninitialized(unsigned length, LChar*& data) { return StringImpl::createUninitialized(length, data); }
WTF_EXPORT_STRING_API void split(const String& separator, Vector<String>& result) const;
WTF_EXPORT_STRING_API void split(const String& separator, bool allowEmptyEntries, Vector<String>& result) const;
WTF_EXPORT_STRING_API void split(UChar separator, Vector<String>& result) const;
void split(const String& separator, Vector<String>& result) const
{
split(separator, false, result);
}
WTF_EXPORT_STRING_API void split(UChar separator, bool allowEmptyEntries, Vector<String>& result) const;
void split(UChar separator, Vector<String>& result) const
{
split(separator, false, result);
}
WTF_EXPORT_STRING_API int toIntStrict(bool* ok = 0, int base = 10) const;
WTF_EXPORT_STRING_API unsigned toUIntStrict(bool* ok = 0, int base = 10) const;
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment