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

ruby-changes:40844

From: ko1 <ko1@a...>
Date: Tue, 8 Dec 2015 03:44:55 +0900 (JST)
Subject: [ruby-changes:40844] ko1:r52923 (trunk): * compile.c (rb_iseq_build_from_ary): do not allocate table

ko1	2015-12-08 03:44:45 +0900 (Tue, 08 Dec 2015)

  New Revision: 52923

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

  Log:
    * compile.c (rb_iseq_build_from_ary): do not allocate table
      if table_size is 0.

  Modified files:
    trunk/ChangeLog
    trunk/compile.c
Index: ChangeLog
===================================================================
--- ChangeLog	(revision 52922)
+++ ChangeLog	(revision 52923)
@@ -1,3 +1,8 @@ https://github.com/ruby/ruby/blob/trunk/ChangeLog#L1
+Tue Dec  8 03:43:21 2015  Koichi Sasada  <ko1@a...>
+
+	* compile.c (rb_iseq_build_from_ary): do not allocate table
+	  if table_size is 0.
+
 Tue Dec  8 03:30:34 2015  Eric Wong  <e@8...>
 
 	* ext/socket/unixsocket.c (unix_send_io): document args
Index: compile.c
===================================================================
--- compile.c	(revision 52922)
+++ compile.c	(revision 52923)
@@ -6545,7 +6545,7 @@ rb_iseq_build_from_ary(rb_iseq_t *iseq, https://github.com/ruby/ruby/blob/trunk/compile.c#L6545
 
     len = RARRAY_LENINT(locals);
     iseq->body->local_table_size = len;
-    iseq->body->local_table = tbl = (ID *)ALLOC_N(ID, iseq->body->local_table_size);
+    iseq->body->local_table = tbl = len > 0 ? (ID *)ALLOC_N(ID, iseq->body->local_table_size) : NULL;
     iseq->body->local_size = iseq->body->local_table_size + 1;
 
     for (i = 0; i < len; i++) {

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

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