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

int nl_cache_add ( struct nl_cache *  cache,
struct nl_object *  obj 

Add object to a cache.

  • cache Cache to add object to
  • obj Object to be added to the cache
Adds the given object to the specified cache. The object is cloned if it has been added to another cache already.

0 or a negative error code.

Definition at line 324 of file cache.c.

References nl_object_clone(), and nl_object_get().

Referenced by nl_cache_subset().

      struct nl_object *new;

      if (cache->c_ops->co_obj_ops != obj->ce_ops)
            return -NLE_OBJ_MISMATCH;

      if (!nl_list_empty(&obj->ce_list)) {
            new = nl_object_clone(obj);
            if (!new)
                  return -NLE_NOMEM;
      } else {
            new = obj;

      return __cache_add(cache, new);

Generated by  Doxygen 1.6.0   Back to index