[svn:parrot] r47212 - branches/gc_massacre/src/gc
bacek at svn.parrot.org
bacek at svn.parrot.org
Mon May 31 11:42:10 UTC 2010
Author: bacek
Date: Mon May 31 11:42:10 2010
New Revision: 47212
URL: https://trac.parrot.org/parrot/changeset/47212
Log:
Use classical algorithm to remove item from list.
Modified:
branches/gc_massacre/src/gc/list.c
Modified: branches/gc_massacre/src/gc/list.c
==============================================================================
--- branches/gc_massacre/src/gc/list.c Mon May 31 11:41:38 2010 (r47211)
+++ branches/gc_massacre/src/gc/list.c Mon May 31 11:42:10 2010 (r47212)
@@ -88,28 +88,22 @@
void
Parrot_gc_list_remove(SHIM_INTERP, ARGMOD(Linked_List *list), ARGMOD(List_Item_Header *item))
{
+ List_Item_Header *next = item->next;
+ List_Item_Header *prev = item->prev;
+
/* First item */
- if (list->first == item) {
- list->first = list->first->next;
- /* Not the last one */
- if (list->first) {
- list->first->prev = NULL;
- }
- }
- else if (list->last == item) {
- list->last = list->last->prev;
- /* It' can't be last item. */
- list->last->next = NULL;
- }
- else {
- List_Item_Header *prev = item->prev;
- List_Item_Header *next = item->next;
- if (prev)
- prev->next = next;
- if (next)
- next->prev = prev;
- item->prev = item->next = NULL;
- }
+ if (list->first == item)
+ list->first = next;
+
+ if (list->last == item)
+ list->last = prev;
+
+ if (prev)
+ prev->next = next;
+ if (next)
+ next->prev = prev;
+
+ item->prev = item->next = NULL;
list->count--;
}
More information about the parrot-commits
mailing list