Lines Matching refs:new
38 * Allocate a new object of kind specified by the operations handle
40 * @return The new object or NULL
44 struct nl_object *new;
46 if (ops->oo_size < sizeof(*new))
49 new = calloc(1, ops->oo_size);
50 if (!new)
53 new->ce_refcnt = 1;
54 nl_init_list_head(&new->ce_list);
56 new->ce_ops = ops;
58 ops->oo_constructor(new);
60 NL_DBG(4, "Allocated new object %p\n", new);
62 return new;
71 * Allocate a new object and copy all data from an existing object
73 * @return The new object or NULL.
77 struct nl_object *new;
82 new = nl_object_alloc(ops);
83 if (!new)
90 new->ce_ops = obj->ce_ops;
91 new->ce_msgtype = obj->ce_msgtype;
94 memcpy((void *)new + doff, (void *)obj + doff, size);
97 if (ops->oo_clone(new, obj) < 0) {
98 nl_object_free(new);
104 return new;