about summary refs log tree commit diff
path: root/Src/linklist.c
diff options
context:
space:
mode:
Diffstat (limited to 'Src/linklist.c')
-rw-r--r--Src/linklist.c36
1 files changed, 32 insertions, 4 deletions
diff --git a/Src/linklist.c b/Src/linklist.c
index 76c32a62d..e449957da 100644
--- a/Src/linklist.c
+++ b/Src/linklist.c
@@ -38,7 +38,19 @@ newlinklist(void)
 {
     LinkList list;
 
-    list = (LinkList) ncalloc(sizeof *list);
+    list = (LinkList) zhalloc(sizeof *list);
+    list->first = NULL;
+    list->last = (LinkNode) list;
+    return list;
+}
+
+/**/
+mod_export LinkList
+znewlinklist(void)
+{
+    LinkList list;
+
+    list = (LinkList) zalloc(sizeof *list);
     list->first = NULL;
     list->last = (LinkNode) list;
     return list;
@@ -53,7 +65,25 @@ insertlinknode(LinkList list, LinkNode node, void *dat)
     LinkNode tmp, new;
 
     tmp = node->next;
-    node->next = new = (LinkNode) ncalloc(sizeof *tmp);
+    node->next = new = (LinkNode) zhalloc(sizeof *tmp);
+    new->last = node;
+    new->dat = dat;
+    new->next = tmp;
+    if (tmp)
+	tmp->last = new;
+    else
+	list->last = new;
+    return new;
+}
+
+/**/
+mod_export LinkNode
+zinsertlinknode(LinkList list, LinkNode node, void *dat)
+{
+    LinkNode tmp, new;
+
+    tmp = node->next;
+    node->next = new = (LinkNode) zalloc(sizeof *tmp);
     new->last = node;
     new->dat = dat;
     new->next = tmp;
@@ -227,8 +257,6 @@ newsizedlist(int size)
     LinkList list;
     LinkNode node;
 
-    MUSTUSEHEAP("newsizedlist()");
-
     list = (LinkList) zhalloc(sizeof(struct linklist) +
 			      (size * sizeof(struct linknode)));