one more safety check: do not remove element if it's not in any list.
authorbarbieri <barbieri>
Tue, 14 Jul 2009 14:00:59 +0000 (14:00 +0000)
committerbarbieri <barbieri@7cbeb6ba-43b4-40fd-8cce-4c39aea84d33>
Tue, 14 Jul 2009 14:00:59 +0000 (14:00 +0000)
This is the best we can do, but what should be done is to check if
element is really from that list.

git-svn-id: http://svn.enlightenment.org/svn/e/trunk/eina@41326 7cbeb6ba-43b4-40fd-8cce-4c39aea84d33

src/lib/eina_inlist.c

index c9fd58f..488b3e0 100644 (file)
@@ -251,6 +251,8 @@ eina_inlist_remove(Eina_Inlist *list, Eina_Inlist *item)
    /* checkme */
    EINA_SAFETY_ON_NULL_RETURN_VAL(list, NULL);
    EINA_SAFETY_ON_NULL_RETURN_VAL(item, list);
+   EINA_SAFETY_ON_TRUE_RETURN_VAL
+     ((item != list) && (item->prev == NULL) && (item->next == NULL), list);
 
    if (item->next)
      item->next->prev = item->prev;