[ovs-dev] [PATCH 1/3] sset: New function sset_intersect().

Ben Pfaff blp at nicira.com
Wed Aug 26 23:58:51 UTC 2015


On Wed, Aug 26, 2015 at 04:56:20PM -0700, Andy Zhou wrote:
> On Wed, Aug 26, 2015 at 4:46 PM, Ben Pfaff <blp at nicira.com> wrote:
> > On Wed, Aug 26, 2015 at 12:34:07PM -0700, Andy Zhou wrote:
> >> On Tue, Aug 25, 2015 at 9:37 PM, Ben Pfaff <blp at nicira.com> wrote:
> >> > +    SSET_FOR_EACH_SAFE (name, next, a) {
> >> > +        if (!sset_contains(b, name)) {
> >> > +            sset_delete(a, SSET_NODE_FROM_NAME(name));
> >> Why not use 'sset_find_and_delete()'?
> >
> > That would re-search the sset for 'name', but we already have a pointer
> > to it via 'a'.
> Sorry, did not get this. It seems they both call sset_find()...

SSET_NODE_FROM_NAME just expands to CONTAINER_OF, and sset_delete() is
just:

    /* Deletes 'node' from 'set' and frees 'node'. */
    void
    sset_delete(struct sset *set, struct sset_node *node)
    {
        hmap_remove(&set->map, &node->hmap_node);
        free(node);
    }

so I'm not sure what you're looking at.



More information about the dev mailing list