예제 #1
0
파일: io.c 프로젝트: Epictetus/mruby-io
mrb_value
mrb_io_s_for_fd(mrb_state *mrb, mrb_value klass)
{
  mrb_value io = mrb_obj_value(mrb_data_object_alloc(mrb, mrb_class_ptr(klass), NULL, &mrb_io_type));

  return mrb_io_initialize(mrb, io);
}
예제 #2
0
파일: io.c 프로젝트: asfluido/mruby
mrb_value
mrb_io_s_for_fd(mrb_state *mrb, mrb_value klass)
{
  struct RClass *c = mrb_class_ptr(klass);
  enum mrb_vtype ttype = MRB_INSTANCE_TT(c);
  mrb_value obj;

  /* copied from mrb_instance_alloc() */
  if (ttype == 0) ttype = MRB_TT_OBJECT;
  obj = mrb_obj_value((struct RObject*)mrb_obj_alloc(mrb, ttype, c));
  return mrb_io_initialize(mrb, obj);
}