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

ruby-changes:46550

From: nobu <ko1@a...>
Date: Thu, 11 May 2017 23:28:44 +0900 (JST)
Subject: [ruby-changes:46550] nobu:r58665 (trunk): gc.c: skip unnecessary check

nobu	2017-05-11 23:28:38 +0900 (Thu, 11 May 2017)

  New Revision: 58665

  https://svn.ruby-lang.org/cgi-bin/viewvc.cgi?view=revision&revision=58665

  Log:
    gc.c: skip unnecessary check
    
    * gc.c (wmap_aset): skip unnecessary size check.
      `2*sizeof(VALUE)` is static and should never overflow.

  Modified files:
    trunk/gc.c
Index: gc.c
===================================================================
--- gc.c	(revision 58664)
+++ gc.c	(revision 58665)
@@ -8464,7 +8464,7 @@ wmap_aset_update(st_data_t *key, st_data https://github.com/ruby/ruby/blob/trunk/gc.c#L8464
     else {
 	optr = 0;
 	size = 1;
-	ptr = ruby_xmalloc2(2, sizeof(VALUE));
+	ptr = ruby_xmalloc0(2 * sizeof(VALUE));
     }
     ptr[0] = size;
     ptr[size] = (VALUE)arg;

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

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