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

ruby-changes:63634

From: Sutou <ko1@a...>
Date: Wed, 18 Nov 2020 09:05:39 +0900 (JST)
Subject: [ruby-changes:63634] e27701291a (master): [ruby/fiddle] Use ruby_xcalloc() instead of ruby_xmalloc() and memset()

https://git.ruby-lang.org/ruby.git/commit/?id=e27701291a

From e27701291a48ee939e0d4713f122d30d07c95773 Mon Sep 17 00:00:00 2001
From: Sutou Kouhei <kou@c...>
Date: Tue, 17 Nov 2020 06:04:00 +0900
Subject: [ruby/fiddle] Use ruby_xcalloc() instead of ruby_xmalloc() and
 memset()

https://github.com/ruby/fiddle/commit/6d24fb5438

diff --git a/ext/fiddle/fiddle.c b/ext/fiddle/fiddle.c
index 5635ab3..546b1dc 100644
--- a/ext/fiddle/fiddle.c
+++ b/ext/fiddle/fiddle.c
@@ -17,9 +17,7 @@ static VALUE https://github.com/ruby/ruby/blob/trunk/ext/fiddle/fiddle.c#L17
 rb_fiddle_malloc(VALUE self, VALUE size)
 {
     void *ptr;
-    size_t sizet = NUM2SIZET(size);
-    ptr = (void*)ruby_xmalloc(sizet);
-    memset(ptr, 0, sizet);
+    ptr = (void*)ruby_xcalloc(1, NUM2SIZET(size));
     return PTR2NUM(ptr);
 }
 
-- 
cgit v0.10.2


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

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