Method: FFI::MemoryPointer#initialize
- Defined in:
- ext/ffi_c/MemoryPointer.c
#initialize(size, count = 1, clear = true) ⇒ self
A new instance of FFI::MemoryPointer.
80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 |
# File 'ext/ffi_c/MemoryPointer.c', line 80
static VALUE
memptr_initialize(int argc, VALUE* argv, VALUE self)
{
VALUE size = Qnil, count = Qnil, clear = Qnil;
int nargs = rb_scan_args(argc, argv, "12", &size, &count, &clear);
memptr_malloc(self, rbffi_type_size(size), nargs > 1 ? NUM2LONG(count) : 1,
RTEST(clear) || clear == Qnil);
if (rb_block_given_p()) {
return rb_ensure(rb_yield, self, memptr_free, self);
}
return self;
}
|