21#if !defined(__RLIB_H_INCLUDE_GUARD__) && !defined(RLIB_COMPILATION)
22#error "#include <rlib.h> only please."
63#include <rlib/data/rlist-internal.h>
75#define r_list_prepend r_list_prepend_copy
77#define r_list_append r_list_append_copy
79#define r_list_contains r_list_contains_full
86#define r_slist_prepend r_slist_prepend_copy
88#define r_slist_append r_slist_append_copy
90#define r_slist_contains r_slist_contains_full
112 if ((ret = r_free_list_alloc0 ()) !=
NULL) {
114 ret->data.notify = notify;
118static inline RFreeList * r_free_list_prepend (RFreeList * lst,
121 return r_free_list_prepend_link (lst, r_free_list_alloc (ptr, notify));
139#define r_cblist_alloc(cb, data, user) \
140 r_cblist_alloc_full (cb, data, NULL, user, NULL)
146#define r_cblist_prepend(head, cb, data, user) \
147 r_cblist_prepend_full (head, cb, data, NULL, user, NULL)
153#define r_cblist_append(head, cb, data, user) \
154 r_cblist_append_full (head, cb, data, NULL, user, NULL)
179#define r_cbrlist_alloc(cb, data, user) \
180 r_cbrlist_alloc_full (cb, data, NULL, user, NULL)
186#define r_cbrlist_prepend(head, cb, data, user) \
187 r_cbrlist_prepend_full (head, cb, data, NULL, user, NULL)
193#define r_cbrlist_append(head, cb, data, user) \
194 r_cbrlist_append_full (head, cb, data, NULL, user, NULL)
220#define r_cbslist_alloc(cb, data, user) \
221 r_cbslist_alloc_full (cb, data, NULL, user, NULL)
227#define r_cbslist_prepend(head, cb, data, user) \
228 r_cbslist_prepend_full (head, cb, data, NULL, user, NULL)
234#define r_cbslist_append(head, cb, data, user) \
235 r_cbslist_append_full (head, cb, data, NULL, user, NULL)
rboolean r_cblist_contains(RCBList *head, RFunc cb, rpointer data)
TRUE iff head contains a matching (cb, data) pair.
RCBList * r_cblist_append_full(RCBList *entry, RFunc cb, rpointer data, RDestroyNotify datanotify, rpointer user, RDestroyNotify usernotify) R_ATTR_WARN_UNUSED_RESULT
Append a new callback to the tail with full ownership wiring.
RCBRList * r_cbrlist_prepend_full(RCBRList *head, RFuncReturn cb, rpointer data, RDestroyNotify datanotify, rpointer user, RDestroyNotify usernotify) R_ATTR_WARN_UNUSED_RESULT
Prepend a return-callback to the head.
RCBSList * r_cbslist_alloc_full(RFunc cb, rpointer data, RDestroyNotify datanotify, rpointer user, RDestroyNotify usernotify)
Allocate a standalone callback node (singly-linked).
RCBRList * r_cbrlist_append_full(RCBRList *entry, RFuncReturn cb, rpointer data, RDestroyNotify datanotify, rpointer user, RDestroyNotify usernotify) R_ATTR_WARN_UNUSED_RESULT
Append a return-callback to the tail.
rboolean r_cbrlist_contains(RCBRList *head, RFuncReturn cb, rpointer data)
TRUE iff head contains a matching (cb, data) pair.
RCBSList * r_cbslist_append_full(RCBSList *entry, RFunc cb, rpointer data, RDestroyNotify datanotify, rpointer user, RDestroyNotify usernotify) R_ATTR_WARN_UNUSED_RESULT
Append a new callback.
RCBRList * r_cbrlist_alloc_full(RFuncReturn cb, rpointer data, RDestroyNotify datanotify, rpointer user, RDestroyNotify usernotify)
Allocate a standalone return-callback node with full ownership wiring.
RCBList * r_cblist_prepend_full(RCBList *head, RFunc cb, rpointer data, RDestroyNotify datanotify, rpointer user, RDestroyNotify usernotify) R_ATTR_WARN_UNUSED_RESULT
Prepend a new callback to the head with full ownership wiring.
RCBSList * r_cbslist_prepend_full(RCBSList *head, RFunc cb, rpointer data, RDestroyNotify datanotify, rpointer user, RDestroyNotify usernotify) R_ATTR_WARN_UNUSED_RESULT
Prepend a new callback.
RCBRList * r_cbrlist_call(RCBRList *head) R_ATTR_WARN_UNUSED_RESULT
Iterate the list, removing entries whose callback returned FALSE.
RCBList * r_cblist_alloc_full(RFunc cb, rpointer data, RDestroyNotify datanotify, rpointer user, RDestroyNotify usernotify)
Allocate a standalone callback node with full ownership wiring.
rboolean r_cbslist_contains(RCBSList *head, RFunc cb, rpointer data)
TRUE iff head contains a matching (cb, data) pair.
rsize r_cblist_call(RCBList *head)
Invoke every callback in the list in order; returns the number called.
rsize r_cbslist_call(RCBSList *head)
Invoke every callback in the list; returns the number called.
#define NULL
Null pointer constant (defined only if absent).
Definition rmacros.h:126
#define R_ATTR_WARN_UNUSED_RESULT
Warn if a function's return value is ignored.
Definition rmacros.h:278
#define R_API
Public-API decoration: resolves to R_API_EXPORT while building rlib and R_API_IMPORT for consumers.
Definition rmacros.h:115
#define R_BEGIN_DECLS
Open an extern "C" block under C++ (no-op in C).
Definition rmacros.h:196
int rboolean
Boolean type (typedef'd to int).
Definition rtypes.h:59
void(* RFunc)(rpointer data, rpointer user)
Generic iteration callback over (data, user) pairs.
Definition rtypes.h:403
void(* RDestroyNotify)(rpointer ptr)
Destructor callback: free / release the value at ptr.
Definition rtypes.h:401
void * rpointer
Generic pointer (alias for void *).
Definition rtypes.h:327
unsigned long rsize
Unsigned pointer-sized size type (like size_t).
Definition rtypes.h:290
rboolean(* RFuncReturn)(rpointer data, rpointer user)
Iteration callback that can short-circuit by returning FALSE.
Definition rtypes.h:419
Callback + data + user-data + per-side destroy-notify tuples used by Linked lists,...
Pre-built hash / equality function pairs for the common key types (pointer-identity,...
Memory allocation, byte-buffer operations, and pattern scanning.
(pointer, destroy-notifier) pair stored in RFreeList.
Definition rlist.h:102
rpointer ptr
Definition rlist.h:103
RDestroyNotify notify
Definition rlist.h:104
Callback context for a void-returning function.
Definition rcbctx.h:61
Callback context for a function that returns rboolean.
Definition rcbctx.h:98