Extended maintenance of Ruby versions 1.8.7 and 1.9.2 ended on July 31, 2014. Read more

In Files

  • dl/dl.c

Parent

Methods

Array

Public Instance Methods

to_ptr(p1 = v1) click to toggle source
 
               VALUE
rb_ary_to_ptr(int argc, VALUE argv[], VALUE self)
{
  void *ptr;
  VALUE t;
  long size;

  switch (rb_scan_args(argc, argv, "01", &t)) {
  case 1:
    ptr = rb_ary2cary(StringValuePtr(t)[0], self, &size);
    break;
  case 0:
    ptr = rb_ary2cary(0, self, &size);
    break;
  }
  if (ptr) {
      VALUE p = rb_dlptr_new(ptr, size, dlfree);
      OBJ_INFECT(p, self);
      return p;
  }
  return Qnil;
}