Avoid adding elements twice

This commit is contained in:
adamdunkels 2010-04-30 07:18:24 +00:00
parent e53b93384a
commit a1f69138d1

View File

@ -43,7 +43,7 @@
*
* Author: Adam Dunkels <adam@sics.se>
*
* $Id: list.c,v 1.3 2010/03/22 11:29:58 fros4943 Exp $
* $Id: list.c,v 1.4 2010/04/30 07:18:24 adamdunkels Exp $
*/
#include "lib/list.h"
@ -166,6 +166,9 @@ list_push(list_t list, void *item)
{
/* struct list *l;*/
/* Make sure not to add the same element twice */
list_remove(list, item);
((struct list *)item)->next = *list;
*list = item;
}