Name
clist_ins_next
Synopsis
int clist_ins_next(CList *list
, CListElmt *element
, const void *data
);
Return Value
0 if inserting the element is successful, or -1 otherwise.
Description
Inserts an element just after
element
in the circular list specified
by list
. When inserting into an empty
list, element
may point anywhere but
should be NULL to avoid confusion. The new element contains a
pointer to data
, so the memory
referenced by data
should remain valid
as long as the element remains in the list. It is the
responsibility of the caller to manage the storage associated with
data
.
Complexity
O (1)
Get Mastering Algorithms with C now with the O’Reilly learning platform.
O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.