diff options
Diffstat (limited to 'libcr_ipc/_linkedlist.h')
-rw-r--r-- | libcr_ipc/_linkedlist.h | 51 |
1 files changed, 0 insertions, 51 deletions
diff --git a/libcr_ipc/_linkedlist.h b/libcr_ipc/_linkedlist.h deleted file mode 100644 index ab6d89e..0000000 --- a/libcr_ipc/_linkedlist.h +++ /dev/null @@ -1,51 +0,0 @@ -/* libcr_ipc/_linkedlist.h - Common low-level linked lists for use in libcr_ipc - * - * Copyright (C) 2024-2025 Luke T. Shumaker <lukeshu@lukeshu.com> - * SPDX-License-Identifier: AGPL-3.0-or-later - */ - -#ifndef _LIBCR_IPC__LINKEDLIST_H_ -#define _LIBCR_IPC__LINKEDLIST_H_ - -#include <libmisc/assert.h> - -#include <libcr_ipc/_linkedlist_pub.h> - -/* singly linked list *********************************************************/ - -typedef struct _cr_ipc_sll_node { - struct _cr_ipc_sll_node *rear; -} cr_ipc_sll_node; - -#define cr_ipc_sll_node_cast(node_typ, node_ptr) \ - ({ \ - static_assert(_Generic(node_ptr, cr_ipc_sll_node *: 1, default: 0), \ - "typeof("#node_ptr") != cr_ipc_sll_node *"); \ - assert(node_ptr); \ - static_assert(offsetof(node_typ, cr_ipc_sll_node) == 0); \ - ((node_typ*)(node_ptr)); \ - }) - -void cr_ipc_sll_push_to_rear(_cr_ipc_sll_root *root, cr_ipc_sll_node *node); -void cr_ipc_sll_pop_from_front(_cr_ipc_sll_root *root); - -/* doubly linked list *********************************************************/ - -typedef struct _cr_ipc_dll_node { - struct _cr_ipc_dll_node *front, *rear; -} cr_ipc_dll_node; - -#define cr_ipc_dll_node_cast(node_typ, node_ptr) \ - ({ \ - static_assert(_Generic(node_ptr, cr_ipc_dll_node *: 1, default: 0), \ - "typeof("#node_ptr") != cr_ipc_dll_node *"); \ - assert(node_ptr); \ - static_assert(offsetof(node_typ, cr_ipc_dll_node) == 0); \ - ((node_typ*)(node_ptr)); \ - }) - -void cr_ipc_dll_push_to_rear(_cr_ipc_dll_root *root, cr_ipc_dll_node *node); -void cr_ipc_dll_remove(_cr_ipc_dll_root *root, cr_ipc_dll_node *node); -void cr_ipc_dll_pop_from_front(_cr_ipc_dll_root *root); - -#endif /* _LIBCR_IPC__LINKEDLIST_H_ */ |