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

struct nl_object* nl_cache_search ( struct nl_cache *  cache,
struct nl_object *  needle 
) [read]

Search for an object in a cache

  • cache Cache to search in.
  • needle Object to look for.
Iterates over the cache and looks for an object with identical identifiers as the needle.

Returns:
Reference to object or NULL if not found.
Note:
The returned object must be returned via nl_object_put().

Definition at line 405 of file cache.c.

References nl_object_get(), and nl_object_identical().

{
      struct nl_object *obj;

      nl_list_for_each_entry(obj, &cache->c_items, ce_list) {
            if (nl_object_identical(obj, needle)) {
                  nl_object_get(obj);
                  return obj;
            }
      }

      return NULL;
}


Generated by  Doxygen 1.6.0   Back to index