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

ruby-changes:51277

From: normal <ko1@a...>
Date: Tue, 22 May 2018 06:40:59 +0900 (JST)
Subject: [ruby-changes:51277] normal:r63483 (trunk): load.c: use ruby_sized_xfree for calloc-ed RArray VALUE

normal	2018-05-22 06:40:54 +0900 (Tue, 22 May 2018)

  New Revision: 63483

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

  Log:
    load.c: use ruby_sized_xfree for calloc-ed RArray VALUE
    
    IMHO, this increases readability, too, since it's not
    immediately clear that the object is on the malloc heap
    and not a regular Ruby object.

  Modified files:
    trunk/load.c
Index: load.c
===================================================================
--- load.c	(revision 63482)
+++ load.c	(revision 63483)
@@ -258,7 +258,7 @@ loaded_features_index_clear_i(st_data_t https://github.com/ruby/ruby/blob/trunk/load.c#L258
     VALUE obj = (VALUE)val;
     if (!SPECIAL_CONST_P(obj)) {
 	rb_ary_free(obj);
-	xfree((void *)obj);
+	ruby_sized_xfree((void *)obj, sizeof(struct RArray));
     }
     return ST_DELETE;
 }

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

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