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

struct nl_object* nl_object_alloc ( struct nl_object_ops ops  )  [read]

Allocate a new object of kind specified by the operations handle

  • ops cache operations handle
    The new object or NULL

Definition at line 42 of file object.c.

References nl_object_ops::oo_constructor, and nl_object_ops::oo_size.

Referenced by nl_object_alloc_name(), and nl_object_clone().

      struct nl_object *new;

      if (ops->oo_size < sizeof(*new))

      new = calloc(1, ops->oo_size);
      if (!new)
            return NULL;

      new->ce_refcnt = 1;

      new->ce_ops = ops;
      if (ops->oo_constructor)

      NL_DBG(4, "Allocated new object %p\n", new);

      return new;

Generated by  Doxygen 1.6.0   Back to index