[前][次][番号順一覧][スレッド一覧]

ruby-changes:27853

From: nobu <ko1@a...>
Date: Sun, 24 Mar 2013 19:43:52 +0900 (JST)
Subject: [ruby-changes:27853] nobu:r39904 (trunk): * vm_method.c (rb_sweep_method_entry): simplify code to unlink.

nobu	2013-03-24 19:43:37 +0900 (Sun, 24 Mar 2013)

  New Revision: 39904

  http://svn.ruby-lang.org/cgi-bin/viewvc.cgi?view=rev&revision=39904

  Log:
    * vm_method.c (rb_sweep_method_entry): simplify code to unlink.

  Modified files:
    trunk/vm_method.c

Index: vm_method.c
===================================================================
--- vm_method.c	(revision 39903)
+++ vm_method.c	(revision 39904)
@@ -122,26 +122,20 @@ void https://github.com/ruby/ruby/blob/trunk/vm_method.c#L122
 rb_sweep_method_entry(void *pvm)
 {
     rb_vm_t *vm = pvm;
-    struct unlinked_method_entry_list_entry *ume = vm->unlinked_method_entry_list, *prev_ume = 0, *curr_ume;
+    struct unlinked_method_entry_list_entry **prev_ume = &vm->unlinked_method_entry_list, *ume = *prev_ume, *curr_ume;
 
     while (ume) {
 	if (ume->me->mark) {
 	    ume->me->mark = 0;
-	    prev_ume = ume;
-	    ume = ume->next;
+	    prev_ume = &ume->next;
+	    ume = *prev_ume;
 	}
 	else {
 	    rb_free_method_entry(ume->me);
 
-	    if (prev_ume == 0) {
-		vm->unlinked_method_entry_list = ume->next;
-	    }
-	    else {
-		prev_ume->next = ume->next;
-	    }
-
 	    curr_ume = ume;
 	    ume = ume->next;
+	    *prev_ume = ume;
 	    xfree(curr_ume);
 	}
     }

--
ML: ruby-changes@q...
Info: http://www.atdot.net/~ko1/quickml/

[前][次][番号順一覧][スレッド一覧]