objlist.c

changeset 92
55fcdff5bcea
parent 91
817f90f58aec
child 101
50525dab6c8e
--- a/objlist.c	Sat Feb 26 21:58:19 2005 +0100
+++ b/objlist.c	Sat Feb 26 22:09:33 2005 +0100
@@ -276,3 +276,49 @@
     
     return TRUE;
 }
+
+
+Obj *objlist_take_first(ObjList **objlist)
+{
+    ObjList *node;
+    Obj*obj;
+    
+    optimise(objlist);
+    
+    node=*objlist;
+    
+    if(node==NULL)
+        return NULL;
+    
+    obj=node->watch.obj;
+    
+    assert(obj!=NULL);
+    
+    free_node(objlist, node);
+    
+    return obj;
+}
+    
+        
+Obj *objlist_take_last(ObjList **objlist)
+{
+    ObjList *node;
+    Obj*obj;
+    
+    optimise(objlist);
+    
+    node=*objlist;
+    
+    if(node==NULL)
+        return NULL;
+    
+    node=node->prev;
+    
+    obj=node->watch.obj;
+
+    assert(obj!=NULL);
+    
+    free_node(objlist, node);
+    
+    return obj;
+}

mercurial