Skip to content

Commit

Permalink
ext/dl/ptr.c: remove rb_dlptr_cast().
Browse files Browse the repository at this point in the history
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@2384 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
  • Loading branch information
ttate committed Apr 19, 2002
1 parent 9021157 commit 75ebf39
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 39 deletions.
4 changes: 4 additions & 0 deletions ChangeLog
Original file line number Diff line number Diff line change
@@ -1,3 +1,7 @@
Thu Apr 18 17:01:43 2002 Takaaki Tateishi <[email protected]>

* ext/dl/ptr.c (rb_dlptr_cast): removed.

Thu Apr 18 17:01:43 2002 Tanaka Akira <[email protected]>

* re.c (rb_reg_to_s): new function for Regexp#to_s.
Expand Down
39 changes: 0 additions & 39 deletions ext/dl/ptr.c
Original file line number Diff line number Diff line change
Expand Up @@ -208,44 +208,6 @@ rb_dlptr_init(int argc, VALUE argv[], VALUE self)
return Qnil;
}

static VALUE
rb_dlptr_cast(int argc, VALUE argv[], VALUE self)
{
VALUE klass, rest, val, *pass_argv;
int pass_argc, i;
struct ptr_data *data;

Data_Get_Struct(self, struct ptr_data, data);
rb_scan_args(argc, argv, "1*", &klass, &rest);

/* prepare the arguments of `new' method */
pass_argc = argc + 1;
pass_argv = ALLOCA_N(VALUE, pass_argc);
pass_argv[0] = DLLONG2NUM(data->ptr);
pass_argv[1] = rb_dlsym_new(data->free, NULL, NULL);
for( i=2; i < pass_argc; i++ ){
pass_argv[i] = rb_ary_entry(rest,i-2);
};

/* remove the data */
((struct ptr_data *)(RDATA(self)->data))->ptr = 0;
(RDATA(self)->dfree)(RDATA(self)->data);

/* call the `new' method of klass with prepared arguments */
val = rb_funcall2(klass, rb_intern("new"), pass_argc, pass_argv);

RDATA(self)->basic.klass = RDATA(val)->basic.klass;
RDATA(self)->basic.flags = RDATA(val)->basic.flags;
RDATA(self)->dmark = RDATA(val)->dmark;
RDATA(self)->dfree = RDATA(val)->dfree;
RDATA(self)->data = RDATA(val)->data;

RDATA(val)->dmark = 0;
RDATA(val)->dfree = 0;

return Qnil;
}

VALUE
rb_dlptr_to_i(VALUE self)
{
Expand Down Expand Up @@ -1050,7 +1012,6 @@ Init_dlptr()
rb_define_method(rb_cDLPtrData, "eql?", rb_dlptr_eql, 1);
rb_define_method(rb_cDLPtrData, "+", rb_dlptr_plus, 1);
rb_define_method(rb_cDLPtrData, "-", rb_dlptr_minus, 1);
rb_define_method(rb_cDLPtrData, "cast!", rb_dlptr_cast, -1);
rb_define_method(rb_cDLPtrData, "define_data_type",
rb_dlptr_define_data_type, -1);
rb_define_method(rb_cDLPtrData, "struct!", rb_dlptr_define_struct, -1);
Expand Down

0 comments on commit 75ebf39

Please sign in to comment.