|
rlib
Convenience library for useful things
|
Linked-list types: doubly / singly linked plus the callback-flavoured specialisations. More...
#include <rlib/data/rlist-internal.h>#include <rlib/data/rcbctx.h>#include <rlib/data/rhashfuncs.h>#include <rlib/rmem.h>Go to the source code of this file.
Data Structures | |
| struct | RFreePtrCtx |
(pointer, destroy-notifier) pair stored in RFreeList. More... | |
Functions | |
Free list — defer cleanup of heterogeneous resources | |
| static RFreeList * | r_free_list_alloc (rpointer ptr, RDestroyNotify notify) |
| static RFreeList * | r_free_list_prepend (RFreeList *lst, rpointer ptr, RDestroyNotify notify) |
Callback list (RCBList — doubly-linked) | |
Doubly-linked list of RFuncCallbackCtx tuples. Use for "fire these callbacks later in order" patterns where the caller also needs to walk in reverse. | |
| #define | r_cblist_alloc(cb, data, user) r_cblist_alloc_full (cb, data, NULL, user, NULL) |
| Convenience: allocate without destroy notifiers. | |
| #define | r_cblist_prepend(head, cb, data, user) r_cblist_prepend_full (head, cb, data, NULL, user, NULL) |
| Convenience: prepend without destroy notifiers. | |
| #define | r_cblist_append(head, cb, data, user) r_cblist_append_full (head, cb, data, NULL, user, NULL) |
| Convenience: append without destroy notifiers. | |
| RCBList * | r_cblist_alloc_full (RFunc cb, rpointer data, RDestroyNotify datanotify, rpointer user, RDestroyNotify usernotify) |
| Allocate a standalone 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. | |
| 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. | |
| rboolean | r_cblist_contains (RCBList *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. | |
Return-value callback list (RCBRList — doubly-linked) | |
Same shape as | |
| #define | r_cbrlist_alloc(cb, data, user) r_cbrlist_alloc_full (cb, data, NULL, user, NULL) |
| Convenience: allocate without destroy notifiers. | |
| #define | r_cbrlist_prepend(head, cb, data, user) r_cbrlist_prepend_full (head, cb, data, NULL, user, NULL) |
| Convenience: prepend without destroy notifiers. | |
| #define | r_cbrlist_append(head, cb, data, user) r_cbrlist_append_full (head, cb, data, NULL, user, NULL) |
| Convenience: append without destroy notifiers. | |
| 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. | |
| 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. | |
| 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. | |
| RCBRList * | r_cbrlist_call (RCBRList *head) R_ATTR_WARN_UNUSED_RESULT |
Iterate the list, removing entries whose callback returned FALSE. | |
Callback list (RCBSList — singly-linked) | |
Same surface as | |
| #define | r_cbslist_alloc(cb, data, user) r_cbslist_alloc_full (cb, data, NULL, user, NULL) |
| Convenience: allocate without destroy notifiers. | |
| #define | r_cbslist_prepend(head, cb, data, user) r_cbslist_prepend_full (head, cb, data, NULL, user, NULL) |
| Convenience: prepend without destroy notifiers. | |
| #define | r_cbslist_append(head, cb, data, user) r_cbslist_append_full (head, cb, data, NULL, user, NULL) |
| Convenience: append without destroy notifiers. | |
| RCBSList * | r_cbslist_alloc_full (RFunc cb, rpointer data, RDestroyNotify datanotify, rpointer user, RDestroyNotify usernotify) |
| Allocate a standalone callback node (singly-linked). | |
| 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. | |
| 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. | |
| rboolean | r_cbslist_contains (RCBSList *head, RFunc cb, rpointer data) |
TRUE iff head contains a matching (cb, data) pair. | |
| rsize | r_cbslist_call (RCBSList *head) |
| Invoke every callback in the list; returns the number called. | |
Linked-list types: doubly / singly linked plus the callback-flavoured specialisations.