From: Ben Pfaff Date: Wed, 24 Dec 2008 23:11:17 +0000 (-0800) Subject: Make tag_set_add() avoid adding tags that are already present. X-Git-Url: https://pintos-os.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=87955e5d078f07808097189bee163847493f223c;p=openvswitch Make tag_set_add() avoid adding tags that are already present. --- diff --git a/lib/tag.c b/lib/tag.c index 9cca57a0..ed198fcb 100644 --- a/lib/tag.c +++ b/lib/tag.c @@ -82,7 +82,7 @@ tag_set_init(struct tag_set *set) void tag_set_add(struct tag_set *set, tag_type tag) { - if (tag) { + if (tag && (!tag_is_valid(tag) || !tag_set_intersects(set, tag))) { /* XXX We could do better by finding the set member to which we would * add the fewest number of 1-bits. This would reduce the amount of * ambiguity, since e.g. three 1-bits match 3 * 2 / 2 = 3 unique tags