summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSutou Kouhei <kou@clear-code.com>2020-11-17 06:04:00 +0900
committerSutou Kouhei <kou@cozmixng.org>2020-11-18 09:05:13 +0900
commite27701291a48ee939e0d4713f122d30d07c95773 (patch)
tree16d26375050f74f0160279b3d799ba1d6be9b4b1
parent1867088d90f6d9116c4c82e875a8e0ed7196bc02 (diff)
[ruby/fiddle] Use ruby_xcalloc() instead of ruby_xmalloc() and memset()
https://github.com/ruby/fiddle/commit/6d24fb5438
Notes
Notes: Merged: https://github.com/ruby/ruby/pull/3780
-rw-r--r--ext/fiddle/fiddle.c4
1 files changed, 1 insertions, 3 deletions
diff --git a/ext/fiddle/fiddle.c b/ext/fiddle/fiddle.c
index 5635ab327c..546b1dc451 100644
--- a/ext/fiddle/fiddle.c
+++ b/ext/fiddle/fiddle.c
@@ -17,9 +17,7 @@ static VALUE
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);
}