ptrlist.c

changeset 92
55fcdff5bcea
parent 90
f5a392131875
child 101
50525dab6c8e
--- a/ptrlist.c	Sat Feb 26 21:58:19 2005 +0100
+++ b/ptrlist.c	Sat Feb 26 22:09:33 2005 +0100
@@ -165,3 +165,36 @@
     return ptr;
 }
 
+
+void *ptrlist_take_first(PtrList **ptrlist)
+{
+    PtrList *node=*ptrlist;
+    void *ptr;
+    
+    if(node==NULL)
+        return NULL;
+    
+    ptr=node->ptr;
+    
+    free_node(ptrlist, node);
+    
+    return ptr;
+}
+    
+        
+void *ptrlist_take_last(PtrList **ptrlist)
+{
+    PtrList *node=*ptrlist;
+    void *ptr;
+    
+    if(node==NULL)
+        return NULL;
+    
+    node=node->prev;
+    
+    ptr=node->ptr;
+    
+    free_node(ptrlist, node);
+    
+    return ptr;
+}

mercurial