[svn:parrot] r47214 - branches/gc_massacre/src/gc

bacek at svn.parrot.org bacek at svn.parrot.org
Mon May 31 11:43:01 UTC 2010


Author: bacek
Date: Mon May 31 11:43:00 2010
New Revision: 47214
URL: https://trac.parrot.org/parrot/changeset/47214

Log:
Simplify List.append

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:42:29 2010	(r47213)
+++ branches/gc_massacre/src/gc/list.c	Mon May 31 11:43:00 2010	(r47214)
@@ -53,17 +53,18 @@
 void
 Parrot_gc_list_append(SHIM_INTERP, ARGMOD(Linked_List *list), ARGMOD(List_Item_Header *item))
 {
-    /* First item */
-    if (!list->first) {
-        list->first = list->last = item;
-        item->prev = item->next = NULL;
-    }
-    else {
+    item->prev = item->next = NULL;
+
+    if (list->last) {
         item->prev = list->last;
-        item->next = NULL;
         list->last->next = item;
-        list->last = item;
     }
+
+    list->last = item;
+
+    if (!list->first)
+        list->first = item;
+
     list->count++;
 }
 


More information about the parrot-commits mailing list