X-Git-Url: http://wien.tomnetworks.com/gitweb/?a=blobdiff_plain;f=src%2Ftoolbox%2Flist.c;h=d6da79efb2fc982e3e01d12091d220e4ef843ccb;hb=6fd72f4d63f219c79b2132dde9ec0aa5e6c1494b;hp=e277eb572a6c21b43f4270fec8458a173e2a2644;hpb=a1159b52f19fb0e9272c1e80491fe90569179c2a;p=cacao.git diff --git a/src/toolbox/list.c b/src/toolbox/list.c index e277eb572..d6da79efb 100644 --- a/src/toolbox/list.c +++ b/src/toolbox/list.c @@ -22,7 +22,7 @@ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. - $Id: list.c 7246 2007-01-29 18:49:05Z twisti $ + $Id: list.c 7596 2007-03-28 21:05:53Z twisti $ */ @@ -131,7 +131,7 @@ void list_add_last(list *l, void *element) } -/* list_add_list_unsynced ****************************************************** +/* list_add_last_unsynced ****************************************************** Adds the element as last element but does NO locking! @@ -200,14 +200,36 @@ void list_add_before(list *l, void *element, void *newelement) } +/* list_remove *************************************************************** + + Removes the element. + +*******************************************************************************/ + void list_remove(list *l, void *element) +{ + LOCK_MONITOR_ENTER(l); + + list_remove_unsynced(l, element); + + LOCK_MONITOR_EXIT(l); +} + + +/* list_remove_unsynced ******************************************************** + + Removes the element but does NO locking! + + ATTENTION: Use this function with care!!! + +*******************************************************************************/ + +void list_remove_unsynced(list *l, void *element) { listnode *ln; ln = (listnode *) (((u1 *) element) + l->nodeoffset); - LOCK_MONITOR_ENTER(l); - if (ln->next) ln->next->prev = ln->prev; else @@ -220,8 +242,6 @@ void list_remove(list *l, void *element) ln->next = NULL; ln->prev = NULL; - - LOCK_MONITOR_EXIT(l); }