diff options
author | Luke T. Shumaker <lukeshu@lukeshu.com> | 2025-04-12 08:34:19 -0600 |
---|---|---|
committer | Luke T. Shumaker <lukeshu@lukeshu.com> | 2025-04-12 08:34:19 -0600 |
commit | ddd3f3982c6cdf8d7d0068e544cc9daf24355d32 (patch) | |
tree | 747821d810bf6ecb97089af088e3946cfc1225ce /libcr_ipc/_linkedlist.h | |
parent | d053a0f6dffc575611324b81acaef0d1554bda6c (diff) | |
parent | e0d67aeb886c75dde8f05120a2d8d1bd2dd2c16c (diff) |
Merge branch 'lukeshu/tidy'
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_ */ |