Title: [132828] trunk/Source/WTF
Revision
132828
Author
[email protected]
Date
2012-10-29 11:18:56 -0700 (Mon, 29 Oct 2012)

Log Message

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):

Modified Paths

Diff

Modified: trunk/Source/WTF/ChangeLog (132827 => 132828)


--- trunk/Source/WTF/ChangeLog	2012-10-29 18:11:05 UTC (rev 132827)
+++ trunk/Source/WTF/ChangeLog	2012-10-29 18:18:56 UTC (rev 132828)
@@ -1,3 +1,19 @@
+2012-10-29  Michael Saboff  <[email protected]>
+
+        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  <[email protected]>
 
         Unreviewed, rolling out r132736.

Modified: trunk/Source/WTF/wtf/text/WTFString.cpp (132827 => 132828)


--- trunk/Source/WTF/wtf/text/WTFString.cpp	2012-10-29 18:11:05 UTC (rev 132827)
+++ trunk/Source/WTF/wtf/text/WTFString.cpp	2012-10-29 18:18:56 UTC (rev 132828)
@@ -665,11 +665,6 @@
         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 @@
         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

Modified: trunk/Source/WTF/wtf/text/WTFString.h (132827 => 132828)


--- trunk/Source/WTF/wtf/text/WTFString.h	2012-10-29 18:11:05 UTC (rev 132827)
+++ trunk/Source/WTF/wtf/text/WTFString.h	2012-10-29 18:18:56 UTC (rev 132828)
@@ -350,10 +350,16 @@
     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;
_______________________________________________
webkit-changes mailing list
[email protected]
http://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to