Rolling out r17865 because it caused a performance regression.
authoraroben <aroben@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Sat, 9 Dec 2006 04:10:59 +0000 (04:10 +0000)
committeraroben <aroben@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Sat, 9 Dec 2006 04:10:59 +0000 (04:10 +0000)
        * loader/TextResourceDecoder.cpp:
        (WebCore::findXMLEncoding):
        * platform/CString.cpp:
        (WebCore::CString::data):
        * platform/CString.h:
        * platform/TextStream.cpp:
        (WebCore::TextStream::operator<<):
        * platform/TextStream.h:

git-svn-id: https://svn.webkit.org/repository/webkit/trunk@18097 268f45cc-cd09-0410-ab3c-d52691b4dbfc

WebCore/ChangeLog
WebCore/loader/TextResourceDecoder.cpp
WebCore/platform/CString.cpp
WebCore/platform/CString.h
WebCore/platform/TextStream.cpp
WebCore/platform/TextStream.h

index bb2340d213d6f60d16665c8815ce8b938737fb17..6c4b90e37f7f8f249867889bd22ac8a06d49bf37 100644 (file)
@@ -1,3 +1,16 @@
+2006-12-08  Adam Roben  <aroben@apple.com>
+
+        Rolling out r17865 because it caused a performance regression.
+
+        * loader/TextResourceDecoder.cpp:
+        (WebCore::findXMLEncoding):
+        * platform/CString.cpp:
+        (WebCore::CString::data):
+        * platform/CString.h:
+        * platform/TextStream.cpp:
+        (WebCore::TextStream::operator<<):
+        * platform/TextStream.h:
+
 2006-12-08  Zack Rusin  <zack@kde.org>
 
         Reviewed by Maciej.
index 42862c4a26df71b5a27de574b5e0ed9e34dacfcf..9799f9993102bf39e68408b37e60b990117f8388 100644 (file)
@@ -296,7 +296,7 @@ void TextResourceDecoder::setEncoding(const TextEncoding& encoding, EncodingSour
 }
 
 // Returns the position of the encoding string.
-static int findXMLEncoding(const CString& str, int &encodingLength)
+static int findXMLEncoding(const DeprecatedCString &str, int &encodingLength)
 {
     int len = str.length();
 
index 6e0285ee067883c8f76766759f9b7b57e7a19d2c..7c33adb816b1321a4787fbaa703d0cc36a4f30ce 100644 (file)
@@ -55,6 +55,11 @@ void CString::init(const char* str, unsigned length)
     m_buffer->data()[length] = '\0';
 }
 
+const char* CString::data() const
+{
+    return m_buffer ? m_buffer->data() : 0;
+}
+
 char* CString::mutableData()
 {
     copyBufferIfNeeded();
@@ -94,36 +99,4 @@ void CString::copyBufferIfNeeded()
     memcpy(m_buffer->data(), m_temp->data(), len);
 }
 
-int CString::find(const char* substring, int index) const
-{
-    const char* str = data();
-    if(str && str[0] && substring && index >=0) { // don't search empty strings
-        // advance until we get to index
-        int pos = 0;
-        while(pos < index)
-            if(str[pos++] == 0)
-                return -1;                  // index is beyond end of str
-        
-        // now search from index onward
-        while(str[index] != 0) {
-            char a, b;
-            
-            // compare until we reach the end or a mismatch
-            pos = 0;
-
-            while((a = substring[pos]) && (b = str[index]) && a == b)
-                pos++, index++;
-            
-            // reached the end of our compare string without a mismatch?
-            if(substring[pos] == 0)
-                return index - pos;
-            
-            index ++;
-        }
-    }
-    
-    return -1;
-}
-
 }
index 8119493de6fdf6e095afb1fdc4e703663132e00b..ddd2d57c578a88b9010ac6fb7511940828cd2054 100644 (file)
@@ -53,19 +53,17 @@ namespace WebCore {
         CString(const char*, unsigned length);
         static CString newUninitialized(size_t length, char*& characterBuffer);
 
-        const char* data() const { return m_buffer ? m_buffer->data() : 0; }
+        const char* data() const;
         char* mutableData();
         unsigned length() const;
 
         operator const char*() const { return data(); }        
-        
+
         bool isNull() const { return !m_buffer; }
 
         CString(const DeprecatedCString&);
         DeprecatedCString deprecatedCString() const;
 
-        int find(const char*, int index=0) const;
-
     private:
         void copyBufferIfNeeded();
         void init(const char*, unsigned length);
index 24c9c02980c2b3eb50362bdd6b5d329ec17489d6..86459693a077260585a4c93969de79c2064d3853 100644 (file)
@@ -122,6 +122,12 @@ TextStream& TextStream::operator<<(const char* s)
     return *this;
 }
 
+TextStream& TextStream::operator<<(const DeprecatedCString& qcs)
+{
+    const char *s = qcs;
+    return *this << s;
+}
+
 TextStream& TextStream::operator<<(const DeprecatedString& s)
 {
     if (m_hasByteArray) {
index 897c26718c273dfb5ef61c5483b590f2774d5805..407229a77c13b0c79ddd83aba7ba1dd5e1515144 100644 (file)
@@ -31,6 +31,7 @@
 namespace WebCore {
 
 class DeprecatedChar;
+class DeprecatedCString;
 class DeprecatedString;
 class String;
 class TextStream;
@@ -56,6 +57,7 @@ public:
     TextStream& operator<<(const char*);
     TextStream& operator<<(const String&);
     TextStream& operator<<(const DeprecatedString&);
+    TextStream& operator<<(const DeprecatedCString&);
     TextStream& operator<<(void*);
 
     TextStream& operator<<(const TextStreamManipulator&);