mirror of
https://github.com/oliverschmidt/contiki.git
synced 2024-12-22 10:30:13 +00:00
Avoid adding elements twice
This commit is contained in:
parent
e53b93384a
commit
a1f69138d1
@ -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;
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user