1
0
Fork 0
mirror of https://github.com/ruby/ruby.git synced 2022-11-09 12:17:21 -05:00

Get rid of STR2CSTR. (Thanks N.Nakada)

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@2553 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
ttate 2002-06-11 14:44:53 +00:00
parent 176542da7f
commit 5434d73ef7
3 changed files with 7 additions and 5 deletions

View file

@ -5,7 +5,7 @@ LDSHARED_TEST = $(LDSHARED) $(LDFLAGS) test/test.o -o test/libtest.so $(LOCAL_LI
libtest.so: test/libtest.so libtest.so: test/libtest.so
test/libtest.so: test/test.o test/libtest.def test/libtest.so: test/test.o $(srcdir)/test/libtest.def
$(RUBY) -rftools -e 'ARGV.each do|d|File.mkpath(File.dirname(d))end' $@ $(RUBY) -rftools -e 'ARGV.each do|d|File.mkpath(File.dirname(d))end' $@
$(LDSHARED_TEST:dl.def=test/libtest.def) $(LDSHARED_TEST:dl.def=test/libtest.def)

View file

@ -582,7 +582,7 @@ rb_dl_callback(int argc, VALUE argv[], VALUE self)
} }
Check_Type(type, T_STRING); Check_Type(type, T_STRING);
switch( STR2CSTR(type)[0] ){ switch( RSTRING(type)->ptr[0] ){
case '0': case '0':
rettype = 0x00; rettype = 0x00;
break; break;
@ -608,7 +608,7 @@ rb_dl_callback(int argc, VALUE argv[], VALUE self)
rettype = 0x07; rettype = 0x07;
break; break;
default: default:
rb_raise(rb_eDLTypeError, "unsupported type `%c'", STR2CSTR(type)[0]); rb_raise(rb_eDLTypeError, "unsupported type `%c'", RSTRING(type)->ptr[0]);
} }
entry = -1; entry = -1;
@ -626,7 +626,8 @@ rb_dl_callback(int argc, VALUE argv[], VALUE self)
rb_assoc_new(INT2NUM(rettype),INT2NUM(entry)), rb_assoc_new(INT2NUM(rettype),INT2NUM(entry)),
rb_assoc_new(type,proc)); rb_assoc_new(type,proc));
sprintf(fname, "rb_dl_callback_func_%d_%d", rettype, entry); sprintf(fname, "rb_dl_callback_func_%d_%d", rettype, entry);
return rb_dlsym_new((void (*)())rb_dl_callback_table[rettype][entry], fname, STR2CSTR(type)); return rb_dlsym_new((void (*)())rb_dl_callback_table[rettype][entry],
fname, RSTRING(type)->ptr);
} }
static VALUE static VALUE

View file

@ -33,7 +33,8 @@ def mkfunc(rettype, fnum, argc)
" obj = rb_hash_aref(DLFuncTable, rb_assoc_new(INT2NUM(#{rettype.to_s}),INT2NUM(#{fnum.to_s})));", " obj = rb_hash_aref(DLFuncTable, rb_assoc_new(INT2NUM(#{rettype.to_s}),INT2NUM(#{fnum.to_s})));",
" proto = rb_ary_entry(obj, 0);", " proto = rb_ary_entry(obj, 0);",
" proc = rb_ary_entry(obj, 1);", " proc = rb_ary_entry(obj, 1);",
" rb_dl_scan_callback_args(buff, STR2CSTR(proto), &argc, argv);", " Check_Type(proto, T_STRING);",
" rb_dl_scan_callback_args(buff, RSTRING(proto)->ptr, &argc, argv);",
" retval = rb_funcall2(proc, id_call, argc, argv);", " retval = rb_funcall2(proc, id_call, argc, argv);",
"", "",
ret_code, ret_code,