[webkit-reviews] review granted: [Bug 12359] XPathEvaluator may return some nodes more than once in a result set : [Attachment 12729] proposed fix

bugzilla-request-daemon at macosforge.org bugzilla-request-daemon at macosforge.org
Sun Jan 28 18:27:38 PST 2007


Darin Adler <darin at apple.com> has granted Darin Adler <darin at apple.com>'s
request for review:
Bug 12359: XPathEvaluator may return some nodes more than once in a result set
http://bugs.webkit.org/show_bug.cgi?id=12359

Attachment 12729: proposed fix
http://bugs.webkit.org/attachment.cgi?id=12729&action=edit

------- Additional Comments from Darin Adler <darin at apple.com>
+		 if (!outDOMNodesSet.contains(node)) {
+		     outDOMNodes.append(node);
+		     outDOMNodesSet.add(node);
+		 }

This can be done more efficiently by taking advantage of the return value from
add. Like this:

    if (outDOMNodesSet.add(node).second)
	outDOMNodes.append(node);

I know it's a little ugly, but I love the fact that it cuts the number of hash
table lookups roughly in half, so please consider this idiom.

r=me



More information about the webkit-reviews mailing list