summaryrefslogtreecommitdiff
path: root/libcr_ipc/_linkedlist.c
diff options
context:
space:
mode:
authorLuke T. Shumaker <lukeshu@lukeshu.com>2025-04-11 07:21:28 -0600
committerLuke T. Shumaker <lukeshu@lukeshu.com>2025-04-11 08:37:33 -0600
commit8db1fb76584a22ec4f93da1b52b3ff63a8e21c96 (patch)
tree358c65a75ec808c520ae230e29bb4ce60a0552bf /libcr_ipc/_linkedlist.c
parentb44c17b2791ffa3f11d96db8fb19fe9e4d45b837 (diff)
Move the linkedlist to libmisc
Diffstat (limited to 'libcr_ipc/_linkedlist.c')
-rw-r--r--libcr_ipc/_linkedlist.c62
1 files changed, 0 insertions, 62 deletions
diff --git a/libcr_ipc/_linkedlist.c b/libcr_ipc/_linkedlist.c
deleted file mode 100644
index b27dba8..0000000
--- a/libcr_ipc/_linkedlist.c
+++ /dev/null
@@ -1,62 +0,0 @@
-/* libcr_ipc/_linkedlist.c - 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
- */
-
-#include <stddef.h> /* for NULL */
-
-#include "_linkedlist.h"
-
-/* singly linked list *********************************************************/
-
-void cr_ipc_sll_push_to_rear(_cr_ipc_sll_root *root, cr_ipc_sll_node *node) {
- assert(root);
- node->rear = NULL;
- if (root->rear)
- root->rear->rear = node;
- else
- root->front = node;
- root->rear = node;
-}
-
-void cr_ipc_sll_pop_from_front(_cr_ipc_sll_root *root) {
- assert(root);
- assert(root->front);
- root->front = root->front->rear;
- if (!root->front)
- root->rear = NULL;
-}
-
-/* doubly linked list *********************************************************/
-
-void cr_ipc_dll_push_to_rear(_cr_ipc_dll_root *root, cr_ipc_dll_node *node) {
- assert(root);
- assert(node);
- node->front = root->rear;
- node->rear = NULL;
- if (root->rear)
- root->rear->rear = node;
- else
- root->front = node;
- root->rear = node;
-}
-
-void cr_ipc_dll_remove(_cr_ipc_dll_root *root, cr_ipc_dll_node *node) {
- assert(root);
- assert(node);
- if (node->front)
- node->front->rear = node->rear;
- else
- root->front = node->rear;
- if (node->rear)
- node->rear->front = node->front;
- else
- root->rear = node->front;
-}
-
-void cr_ipc_dll_pop_from_front(_cr_ipc_dll_root *root) {
- assert(root);
- assert(root->front);
- cr_ipc_dll_remove(root, root->front);
-}