diff options
author | Sutou Kouhei <kou@clear-code.com> | 2020-11-17 06:04:00 +0900 |
---|---|---|
committer | Sutou Kouhei <kou@cozmixng.org> | 2020-11-18 09:05:13 +0900 |
commit | e27701291a48ee939e0d4713f122d30d07c95773 (patch) | |
tree | 16d26375050f74f0160279b3d799ba1d6be9b4b1 | |
parent | 1867088d90f6d9116c4c82e875a8e0ed7196bc02 (diff) | |
download | ruby-e27701291a48ee939e0d4713f122d30d07c95773.tar.gz |
[ruby/fiddle] Use ruby_xcalloc() instead of ruby_xmalloc() and memset()
https://github.com/ruby/fiddle/commit/6d24fb5438
-rw-r--r-- | ext/fiddle/fiddle.c | 4 |
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); } |