mirror of
https://github.com/ruby/ruby.git
synced 2022-11-09 12:17:21 -05:00
[ruby/fiddle] Use ruby_xcalloc() instead of ruby_xmalloc() and memset()
https://github.com/ruby/fiddle/commit/6d24fb5438
This commit is contained in:
parent
1867088d90
commit
e27701291a
Notes:
git
2020-11-18 09:05:45 +09:00
1 changed files with 1 additions and 3 deletions
|
@ -17,9 +17,7 @@ static VALUE
|
||||||
rb_fiddle_malloc(VALUE self, VALUE size)
|
rb_fiddle_malloc(VALUE self, VALUE size)
|
||||||
{
|
{
|
||||||
void *ptr;
|
void *ptr;
|
||||||
size_t sizet = NUM2SIZET(size);
|
ptr = (void*)ruby_xcalloc(1, NUM2SIZET(size));
|
||||||
ptr = (void*)ruby_xmalloc(sizet);
|
|
||||||
memset(ptr, 0, sizet);
|
|
||||||
return PTR2NUM(ptr);
|
return PTR2NUM(ptr);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Add table
Reference in a new issue