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

ruby-changes:27064

From: charliesome <ko1@a...>
Date: Wed, 6 Feb 2013 22:53:43 +0900 (JST)
Subject: [ruby-changes:27064] charliesome:r39116 (trunk): * hash.c (env_reject_bang): hide keys array from ObjectSpace

charliesome	2013-02-06 22:46:26 +0900 (Wed, 06 Feb 2013)

  New Revision: 39116

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

  Log:
    * hash.c (env_reject_bang): hide keys array from ObjectSpace
    * hash.c (env_select_bang): ditto

  Modified files:
    trunk/ChangeLog
    trunk/hash.c

Index: ChangeLog
===================================================================
--- ChangeLog	(revision 39115)
+++ ChangeLog	(revision 39116)
@@ -1,3 +1,8 @@ https://github.com/ruby/ruby/blob/trunk/ChangeLog#L1
+Wed Feb  6 22:25:00 2013  Charlie Somerville  <charlie@c...>
+
+	* hash.c (env_reject_bang): hide keys array from ObjectSpace
+	* hash.c (env_select_bang): ditto
+
 Wed Feb  6 17:33:01 2013  Nobuyoshi Nakada  <nobu@r...>
 
 	* configure.in (multiarch): add option to move architecture dependent
Index: hash.c
===================================================================
--- hash.c	(revision 39115)
+++ hash.c	(revision 39116)
@@ -2713,6 +2713,7 @@ env_reject_bang(VALUE ehash) https://github.com/ruby/ruby/blob/trunk/hash.c#L2713
 
     RETURN_SIZED_ENUMERATOR(ehash, 0, 0, rb_env_size);
     keys = env_keys();	/* rb_secure(4); */
+    RBASIC(keys)->klass = 0;
     for (i=0; i<RARRAY_LEN(keys); i++) {
 	VALUE val = rb_f_getenv(Qnil, RARRAY_PTR(keys)[i]);
 	if (!NIL_P(val)) {
@@ -2816,6 +2817,7 @@ env_select_bang(VALUE ehash) https://github.com/ruby/ruby/blob/trunk/hash.c#L2817
 
     RETURN_SIZED_ENUMERATOR(ehash, 0, 0, rb_env_size);
     keys = env_keys();	/* rb_secure(4); */
+    RBASIC(keys)->klass = 0;
     for (i=0; i<RARRAY_LEN(keys); i++) {
 	VALUE val = rb_f_getenv(Qnil, RARRAY_PTR(keys)[i]);
 	if (!NIL_P(val)) {

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

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