[Webkit-unassigned] [Bug 38572] [WTFURL] Add core URL parser

bugzilla-daemon at webkit.org bugzilla-daemon at webkit.org
Fri May 7 10:58:00 PDT 2010


https://bugs.webkit.org/show_bug.cgi?id=38572





--- Comment #27 from Adam Barth <abarth at webkit.org>  2010-05-07 10:57:59 PST ---
(In reply to comment #25)
> > I'm not sure how to break out of the loop without a goto, and I'm not sure
> > having a goto improve readability.  :)
> 
>         for (int i = path.begin(); i < pathEnd; i++) {
>             switch (spec[i]) {
>             case '?':
>                 // Only match the query string if it precedes the reference
> fragment
>                 // and when we haven't found one already.
> -                if (refSeparator < 0 && querySeparator < 0)
> +                if (querySeparator < 0)
>                     querySeparator = i;
>                 break;
>             case '#':
>                 // Record the first # sign only.
> -                if (refSeparator < 0)
> -                    refSeparator = i;
> +                refSeparator = i;
> +                i = pathEnd; // Break out of the loop.
>                 break;
>             default:
>                 break;
>             }
>         }

Done.

> > What name do you suggest?  I've changed it to "specLength" because that's the
> > name of the parameter that's always supplied.  (Note that although "end" is a
> > tempting name, it's actually end+1.)
> 
> I don't see it changed in trimURL(), which is the function I was commenting
> about.
> 
> It's a common idiom to use "end" for a position just after the end, see e.g.
> Vector::end(), or even the code quoted above that uses pathEnd.

Done.

-- 
Configure bugmail: https://bugs.webkit.org/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are the assignee for the bug.



More information about the webkit-unassigned mailing list