[Webkit-unassigned] [Bug 39471] Reduce copy/paste code in HTMLParser using some template functions
bugzilla-daemon at webkit.org
bugzilla-daemon at webkit.org
Fri May 21 19:18:46 PDT 2010
https://bugs.webkit.org/show_bug.cgi?id=39471
--- Comment #6 from James Robinson <jamesr at chromium.org> 2010-05-21 19:18:45 PST ---
(From update of attachment 56675)
I think it's clearer. A few nits, though (I'm not a reviewer so I won't touch the review flag).
> +template< size_t ArraySize >
> +static void addTags(TagNameSet& set, QualifiedName (&names)[ArraySize])
Can we get a comment with an explanation of this syntax or a link or something? I just looked at this so I know how to read the second declaration but by next week I will probably forget and have to spend a while pondering what the parens signify here.
> +{
> + for (size_t x = 0; x < ArraySize; x++) {
x is an odd choice for a loop index. Why not i?
> + const QualifiedName& name = names[x];
I don't think the temp var here adds very much
> + set.add(name.localName().impl());
> + }
>
> +static void mapTagToFunc(FunctionMap& map, const QualifiedName& tag, CreateErrorCheckFunc func)
> +{
> + map.set(tag.localName().impl(), func);
> +}
> +
> +template< size_t ArraySize >
> +static void mapTagsToFunc(FunctionMap& map, QualifiedName (&names)[ArraySize], CreateErrorCheckFunc func)
> +{
> + for (size_t x = 0; x < ArraySize; x++) {
> + const QualifiedName& name = names[x];
Same comments as above (x is unusual for a loop index, temp is of iffy value).
> + mapTagToFunc(map, name, func);
> + }
> +}
> +
> PassRefPtr<Node> HTMLParser::getNode(Token* t)
> {
> // Init our error handling table.
--
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