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

int nl_object_identical ( struct nl_object *  a,
struct nl_object *  b 
)

Check if the identifiers of two objects are identical

  • a an object
  • b another object of same type
Returns:
true if both objects have equal identifiers, otherwise false.

Definition at line 258 of file object.c.

References nl_object_ops::oo_compare, and nl_object_ops::oo_id_attrs.

Referenced by nl_cache_search().

{
      struct nl_object_ops *ops = obj_ops(a);
      int req_attrs;

      /* Both objects must be of same type */
      if (ops != obj_ops(b))
            return 0;

      req_attrs = ops->oo_id_attrs;

      /* Both objects must provide all required attributes to uniquely
       * identify an object */
      if ((a->ce_mask & req_attrs) != req_attrs ||
          (b->ce_mask & req_attrs) != req_attrs)
            return 0;

      /* Can't judge unless we can compare */
      if (ops->oo_compare == NULL)
            return 0;

      return !(ops->oo_compare(a, b, req_attrs, 0));
}


Generated by  Doxygen 1.6.0   Back to index