Summary: | Use StringView::split() instead of String::split() in more places | ||||||||
---|---|---|---|---|---|---|---|---|---|
Product: | WebKit | Reporter: | Chris Dumez <cdumez> | ||||||
Component: | WebCore Misc. | Assignee: | Chris Dumez <cdumez> | ||||||
Status: | RESOLVED FIXED | ||||||||
Severity: | Normal | CC: | benjamin, changseok, cmarcelo, darin, dino, esprehn+autocc, ews-watchlist, fmalita, ggaren, gyuyoung.kim, hi, joepeck, kondapallykalyan, mifenton, pangle, pdr, sabouhallawa, schenney, sergio, webkit-bug-importer | ||||||
Priority: | P2 | Keywords: | InRadar | ||||||
Version: | WebKit Nightly Build | ||||||||
Hardware: | Unspecified | ||||||||
OS: | Unspecified | ||||||||
Attachments: |
|
Description
Chris Dumez
2022-03-24 22:26:09 PDT
Created attachment 455725 [details]
Patch
Comment on attachment 455725 [details] 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) ... } Comment on attachment 455725 [details] Patch View in context: https://bugs.webkit.org/attachment.cgi?id=455725&action=review >> Source/WebCore/html/ValidationMessage.cpp:137 >> + 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) > ... > } Hmm, this is the only case in this patch where I added an 'i' counter it seems. Also, I think in this particular instance, I could probably replace this counter by a simple boolean. Created attachment 455786 [details]
Patch
Committed r291902 (248895@main): <https://commits.webkit.org/248895@main> All reviewed patches have been landed. Closing bug and clearing flags on attachment 455786 [details]. |