aboutsummaryrefslogtreecommitdiff
path: root/utils.c
diff options
context:
space:
mode:
Diffstat (limited to 'utils.c')
-rw-r--r--utils.c18
1 files changed, 18 insertions, 0 deletions
diff --git a/utils.c b/utils.c
index 11c3d68..b727ef0 100644
--- a/utils.c
+++ b/utils.c
@@ -286,6 +286,24 @@ xstrndup (const char *s, size_t n)
(link)->next->prev = (link)->prev; \
BLOCK_END
+#define LIST_APPEND_WITH_TAIL(head, tail, link) \
+ BLOCK_START \
+ (link)->prev = (tail); \
+ (link)->next = NULL; \
+ if ((link)->prev) \
+ (link)->prev->next = (link); \
+ else \
+ (head) = (link); \
+ (tail) = (link); \
+ BLOCK_END
+
+#define LIST_UNLINK_WITH_TAIL(head, tail, link) \
+ BLOCK_START \
+ if ((tail) == (link)) \
+ (tail) = (link)->prev; \
+ LIST_UNLINK ((head), (link)); \
+ BLOCK_END
+
// --- Dynamically allocated string array --------------------------------------
struct str_vector