aboutsummaryrefslogtreecommitdiff
path: root/utils.c
diff options
context:
space:
mode:
authorPřemysl Janouch <p.janouch@gmail.com>2014-09-18 20:59:29 +0200
committerPřemysl Janouch <p.janouch@gmail.com>2014-09-18 21:01:42 +0200
commit64fa986cd089b60ef5da72cfa149813041011537 (patch)
treec1cc055c57fb994ed72ffa8c4a92d2cdfa6a7e11 /utils.c
parent0a7ff1d6388546701e96a749a736e890645df9dc (diff)
downloadponymap-64fa986cd089b60ef5da72cfa149813041011537.tar.gz
ponymap-64fa986cd089b60ef5da72cfa149813041011537.tar.xz
ponymap-64fa986cd089b60ef5da72cfa149813041011537.zip
Implement the indicator etc.
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