]> mj.ucw.cz Git - libucw.git/commitdiff
Libucw: Remove lists.{h,c}
authorMichal Vaner <vorner@ucw.cz>
Thu, 17 Jul 2008 10:57:50 +0000 (12:57 +0200)
committerMartin Mares <mj@ucw.cz>
Thu, 17 Jul 2008 21:02:13 +0000 (23:02 +0200)
All remaining references to it replaced by clists.

ucw/Makefile
ucw/lists.c [deleted file]
ucw/lists.h [deleted file]

index b803e7d4391def7d555d7dc1e981bcd201199b15..68094263eb9e31976054ce8761d8fe6fe9adae08 100644 (file)
@@ -9,7 +9,7 @@ LIBUCW_MODS= \
        threads \
        alloc alloc_str realloc bigalloc mempool mempool-str mempool-fmt eltpool \
        mmap partmap hashfunc \
-       lists slists simple-lists bitsig \
+       slists simple-lists bitsig \
        log log-file proctitle \
        conf-alloc conf-dump conf-input conf-intr conf-journal conf-parse conf-section \
        ipaccess \
@@ -35,7 +35,7 @@ LIBUCW_INCLUDES= \
        lib.h config.h threads.h \
        mempool.h \
        arraysort.h \
-       lists.h clists.h slists.h simple-lists.h \
+       clists.h slists.h simple-lists.h \
        string.h stkstring.h unicode.h chartype.h regex.h \
        wildmatch.h \
        unaligned.h prefetch.h \
diff --git a/ucw/lists.c b/ucw/lists.c
deleted file mode 100644 (file)
index c5c5b95..0000000
+++ /dev/null
@@ -1,77 +0,0 @@
-/*
- *     UCW Library -- Linked Lists
- *
- *     (c) 1997--1999 Martin Mares <mj@ucw.cz>
- *
- *     This software may be freely distributed and used according to the terms
- *     of the GNU Lesser General Public License.
- */
-
-#include "ucw/lib.h"
-
-#define _UCW_LISTS_C
-#include "ucw/lists.h"
-
-LIST_INLINE void
-add_tail(list *l, node *n)
-{
-  node *z = l->tail;
-
-  n->next = (node *) &l->null;
-  n->prev = z;
-  z->next = n;
-  l->tail = n;
-}
-
-LIST_INLINE void
-add_head(list *l, node *n)
-{
-  node *z = l->head;
-
-  n->next = z;
-  n->prev = (node *) &l->head;
-  z->prev = n;
-  l->head = n;
-}
-
-LIST_INLINE void
-insert_node(node *n, node *after)
-{
-  node *z = after->next;
-
-  n->next = z;
-  n->prev = after;
-  after->next = n;
-  z->prev = n;
-}
-
-LIST_INLINE void
-rem_node(node *n)
-{
-  node *z = n->prev;
-  node *x = n->next;
-
-  z->next = x;
-  x->prev = z;
-}
-
-LIST_INLINE void
-init_list(list *l)
-{
-  l->head = (node *) &l->null;
-  l->null = NULL;
-  l->tail = (node *) &l->head;
-}
-
-LIST_INLINE void
-add_tail_list(list *to, list *l)
-{
-  node *p = to->tail;
-  node *q = l->head;
-
-  p->next = q;
-  q->prev = p;
-  q = l->tail;
-  q->next = (node *) &to->null;
-  to->tail = q;
-}
diff --git a/ucw/lists.h b/ucw/lists.h
deleted file mode 100644 (file)
index 7f3bf99..0000000
+++ /dev/null
@@ -1,64 +0,0 @@
-/*
- *     UCW Library -- Linked Lists
- *
- *     (c) 1997--1999 Martin Mares <mj@ucw.cz>
- *
- *     This software may be freely distributed and used according to the terms
- *     of the GNU Lesser General Public License.
- */
-
-#ifndef _UCW_LISTS_H
-#define _UCW_LISTS_H
-
-/*
- * I admit the list structure is very tricky and also somewhat awkward,
- * but it's both efficient and easy to manipulate once one understands the
- * basic trick: The list head always contains two synthetic nodes which are
- * always present in the list: the head and the tail. But as the `next'
- * entry of the tail and the `prev' entry of the head are both NULL, the
- * nodes can overlap each other:
- *
- *     head    head_node.next
- *     null    head_node.prev  tail_node.next
- *     tail                    tail_node.prev
- */
-
-typedef struct node {
-  struct node *next, *prev;
-} node;
-
-typedef struct list {                  /* In fact two overlayed nodes */
-  struct node *head, *null, *tail;
-} list;
-
-#define NODE (node *)
-#define HEAD(list) ((void *)((list).head))
-#define TAIL(list) ((void *)((list).tail))
-#define WALK_LIST(n,list) for(n=HEAD(list);(NODE (n))->next; \
-                               n=(void *)((NODE (n))->next))
-#define DO_FOR_ALL(n,list) WALK_LIST(n,list)
-#define WALK_LIST_DELSAFE(n,nxt,list) \
-     for(n=HEAD(list); nxt=(void *)((NODE (n))->next); n=(void *) nxt)
-#define WALK_LIST_BACKWARDS(n,list) for(n=TAIL(list);(NODE (n))->prev; \
-                               n=(void *)((NODE (n))->prev))
-#define WALK_LIST_BACKWARDS_DELSAFE(n,prv,list) \
-     for(n=TAIL(list); prv=(void *)((NODE (n))->prev); n=(void *) prv)
-
-#define EMPTY_LIST(list) (!(list).head->next)
-
-void add_tail(list *, node *);
-void add_head(list *, node *);
-void rem_node(node *);
-void add_tail_list(list *, list *);
-void init_list(list *);
-void insert_node(node *, node *);
-
-#if !defined(_UCW_LISTS_C) && defined(__GNUC__)
-#define LIST_INLINE extern inline
-#include "ucw/lists.c"
-#undef LIST_INLINE
-#else
-#define LIST_INLINE
-#endif
-
-#endif