Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(637)

Unified Diff: Source/core/dom/Document.cpp

Issue 387313002: Shrink isValidNameNonASCII by using U16_NEXT only once. (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: Created 6 years, 5 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: Source/core/dom/Document.cpp
diff --git a/Source/core/dom/Document.cpp b/Source/core/dom/Document.cpp
index 4b97db5687594905c5098d97a830f72460741aa7..2c24d0f76f36da5bbe38fc421f3cecb33840e009 100644
--- a/Source/core/dom/Document.cpp
+++ b/Source/core/dom/Document.cpp
@@ -4105,16 +4105,11 @@ static bool isValidNameNonASCII(const LChar* characters, unsigned length)
static bool isValidNameNonASCII(const UChar* characters, unsigned length)
{
- unsigned i = 0;
-
- UChar32 c;
- U16_NEXT(characters, i, length, c)
- if (!isValidNameStart(c))
- return false;
-
- while (i < length) {
- U16_NEXT(characters, i, length, c)
- if (!isValidNamePart(c))
+ for (unsigned i = 0; i < length;) {
fs 2014/09/04 12:01:18 Some might be alarmed by a for lacking an update e
+ bool first = i == 0;
fs 2014/09/04 12:01:18 I suppose this could also be: bool nameStart = tr
+ UChar32 c;
+ U16_NEXT(characters, i, length, c); // Increments i.
+ if (first ? !isValidNameStart(c) : !isValidNamePart(c))
return false;
}
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698