From e1672a0c2b65979e8a13c6ed455eaf392d4efb7d Mon Sep 17 00:00:00 2001 From: Mathieu Desnoyers Date: Mon, 18 Dec 2023 09:28:00 -0500 Subject: [PATCH] Introduce list_types.h Signed-off-by: Mathieu Desnoyers --- src/list.h | 17 +---------------- src/list_types.h | 26 ++++++++++++++++++++++++++ 2 files changed, 27 insertions(+), 16 deletions(-) create mode 100644 src/list_types.h diff --git a/src/list.h b/src/list.h index f017e1a..fc97605 100644 --- a/src/list.h +++ b/src/list.h @@ -6,22 +6,7 @@ #ifndef _SIDE_LIST_H #define _SIDE_LIST_H -struct side_list_node { - struct side_list_node *next; - struct side_list_node *prev; -}; - -struct side_list_head { - struct side_list_node node; -}; - -#define DEFINE_SIDE_LIST_HEAD(_identifier) \ - struct side_list_head _identifier = { \ - .node = { \ - .next = &(_identifier).node, \ - .prev = &(_identifier).node, \ - }, \ - } +#include "list_types.h" static inline void side_list_insert_node_tail(struct side_list_head *head, struct side_list_node *node) diff --git a/src/list_types.h b/src/list_types.h new file mode 100644 index 0000000..e725eff --- /dev/null +++ b/src/list_types.h @@ -0,0 +1,26 @@ +// SPDX-License-Identifier: MIT +/* + * Copyright 2022 Mathieu Desnoyers + */ + +#ifndef _SIDE_LIST_TYPES_H +#define _SIDE_LIST_TYPES_H + +struct side_list_node { + struct side_list_node *next; + struct side_list_node *prev; +}; + +struct side_list_head { + struct side_list_node node; +}; + +#define DEFINE_SIDE_LIST_HEAD(_identifier) \ + struct side_list_head _identifier = { \ + .node = { \ + .next = &(_identifier).node, \ + .prev = &(_identifier).node, \ + }, \ + } + +#endif /* _SIDE_LIST_TYPES_H */ -- 2.34.1