[webkit-reviews] review granted: [Bug 238362] Use StringView::split() instead of String::split() in more places : [Attachment 455725] Patch

bugzilla-daemon at webkit.org bugzilla-daemon at webkit.org
Fri Mar 25 09:59:56 PDT 2022


Geoffrey Garen <ggaren at apple.com> has granted Chris Dumez <cdumez at apple.com>'s
request for review:
Bug 238362: Use StringView::split() instead of String::split() in more places
https://bugs.webkit.org/show_bug.cgi?id=238362

Attachment 455725: Patch

https://bugs.webkit.org/attachment.cgi?id=455725&action=review




--- Comment #2 from Geoffrey Garen <ggaren at apple.com> ---
Comment on attachment 455725
  --> https://bugs.webkit.org/attachment.cgi?id=455725
Patch

View in context: https://bugs.webkit.org/attachment.cgi?id=455725&action=review

r=me

> Source/WebCore/html/ValidationMessage.cpp:137
> +    size_t i = 0;
> +    for (auto line : lines) {

As you add more loops with explicit 'I' counters, I wonder if we can create
some helper class whose purpose is to wrap an iterator and offer a counter
automatically. Something like:

for (auto line : iteratorWithIndex(lines) {
    if (line.index() > 1)
	...
}

Or:

for (auto line : countedIterator(lines) {
    if (line.counter() > 1)
	...
}


More information about the webkit-reviews mailing list