Logo Search packages:      
Sourcecode: libnl2 version File versions  Download package

int nl_cache_nitems_filter ( struct nl_cache *  cache,
struct nl_object *  filter 
)

Return the number of items matching a filter in the cache

  • cache Cache object.
  • filter Filter object.

Definition at line 68 of file cache.c.

References nl_object_match_filter().

{
      struct nl_object_ops *ops;
      struct nl_object *obj;
      int nitems = 0;

      if (cache->c_ops == NULL)
            BUG();

      ops = cache->c_ops->co_obj_ops;
      
      nl_list_for_each_entry(obj, &cache->c_items, ce_list) {
            if (filter && !nl_object_match_filter(obj, filter))
                  continue;

            nitems++;
      }

      return nitems;
}


Generated by  Doxygen 1.6.0   Back to index