[webkit-reviews] review granted: [Bug 21596] WebCore::Cache should use parsed Pragma and Cache-Control headers : [Attachment 24585] Patch v2

bugzilla-daemon at webkit.org bugzilla-daemon at webkit.org
Thu Oct 23 13:08:18 PDT 2008


Antti Koivisto <koivisto at iki.fi> has granted David Kilzer (ddkilzer)
<ddkilzer at webkit.org>'s request for review:
Bug 21596: WebCore::Cache should use parsed Pragma and Cache-Control headers
https://bugs.webkit.org/show_bug.cgi?id=21596

Attachment 24585: Patch v2
https://bugs.webkit.org/attachment.cgi?id=24585&action=edit

------- Additional Comments from Antti Koivisto <koivisto at iki.fi>
Looks good, r=me. One minor comment:

> +PassRefPtr<StringImpl>
StringImpl::removeCharacters(CharacterMatchFunctionPtr findMatch)
> +{
> +    StringBuffer data(m_length);
> +
> +    const UChar* from = m_data;
> +    const UChar* fromend = from + m_length;
> +    unsigned outc = 0;
> +
> +    UChar* to = data.characters();
> +
> +    while (true) {
> +	   while (from != fromend && findMatch(*from))
> +	       from++;
> +	   while (from != fromend && !findMatch(*from))
> +	       to[outc++] = *from++;
> +	   if (from == fromend)
> +	       break;
> +    }
> +
> +    if (outc == m_length)
> +	   return this;

It would be more optimal to allocate the buffer when the first removable
character is found. That would avoid unnecessary malloc/free in no removals
case.


More information about the webkit-reviews mailing list