diff lib/llist.c @ 1060:c2663b7eca78 draft

Adjust patch to use dlist_pop()
author Rob Landley <rob@landley.net>
date Mon, 09 Sep 2013 05:26:52 -0500
parents ef72a16f4b3a
children 114ec0ab161c
line wrap: on
line diff
--- a/lib/llist.c	Mon Sep 09 04:26:03 2013 -0500
+++ b/lib/llist.c	Mon Sep 09 05:26:52 2013 -0500
@@ -37,8 +37,11 @@
 {
   struct double_list **pdlist = (struct double_list **)list, *dlist = *pdlist;
 
-  dlist->next->prev = dlist->prev;
-  dlist->prev->next = *pdlist = dlist->next;
+  if (dlist->next == dlist) *pdlist = 0;
+  else {
+    dlist->next->prev = dlist->prev;
+    dlist->prev->next = *pdlist = dlist->next;
+  }
 
   return dlist;
 }