summaryrefslogtreecommitdiff
path: root/ext/dl/cfunc.c
diff options
context:
space:
mode:
authornobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2010-02-16 10:03:02 +0000
committernobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2010-02-16 10:03:02 +0000
commitda2497745e207c20b632ec14731397fb48a52fd2 (patch)
tree97696eb7663f1654e3fb7c38dbf20d104b0c0e70 /ext/dl/cfunc.c
parent53dddcf88e6f522d120e9b7df8c249f945eec556 (diff)
* test/dl/test_{base,handle}.rb: use more verbose assertions.
* test/dl/test_import.rb (DL::LIBC::BoundQsortCallback): renamed to get rid of overwriting warning. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@26680 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'ext/dl/cfunc.c')
-rw-r--r--ext/dl/cfunc.c16
1 files changed, 8 insertions, 8 deletions
diff --git a/ext/dl/cfunc.c b/ext/dl/cfunc.c
index 4d10c82ff2c..2c0cd5f2409 100644
--- a/ext/dl/cfunc.c
+++ b/ext/dl/cfunc.c
@@ -147,12 +147,12 @@ rb_dlcfunc_initialize(int argc, VALUE argv[], VALUE self)
struct cfunc_data *data;
void *saddr;
const char *sname;
-
+
rb_scan_args(argc, argv, "13", &addr, &type, &name, &calltype);
-
+
saddr = (void*)(NUM2PTR(rb_Integer(addr)));
sname = NIL_P(name) ? NULL : StringValuePtr(name);
-
+
TypedData_Get_Struct(self, struct cfunc_data, &dlcfunc_data_type, data);
if( data->name ) xfree(data->name);
data->ptr = saddr;
@@ -286,9 +286,9 @@ rb_dlcfunc_inspect(VALUE self)
char *str;
int str_size;
struct cfunc_data *cfunc;
-
+
TypedData_Get_Struct(self, struct cfunc_data, &dlcfunc_data_type, cfunc);
-
+
str_size = (cfunc->name ? strlen(cfunc->name) : 0) + 100;
str = ruby_xmalloc(str_size);
snprintf(str, str_size - 1,
@@ -339,14 +339,14 @@ rb_dlcfunc_call(VALUE self, VALUE ary)
memset(stack, 0, sizeof(DLSTACK_TYPE) * DLSTACK_SIZE);
Check_Type(ary, T_ARRAY);
-
+
TypedData_Get_Struct(self, struct cfunc_data, &dlcfunc_data_type, cfunc);
if( cfunc->ptr == 0 ){
rb_raise(rb_eDLError, "can't call null-function");
return Qnil;
}
-
+
for( i = 0; i < RARRAY_LEN(ary); i++ ){
if( i >= DLSTACK_SIZE ){
rb_raise(rb_eDLError, "too many arguments (stack overflow)");
@@ -354,7 +354,7 @@ rb_dlcfunc_call(VALUE self, VALUE ary)
rb_check_safe_obj(RARRAY_PTR(ary)[i]);
stack[i] = NUM2LONG(RARRAY_PTR(ary)[i]);
}
-
+
/* calltype == CFUNC_CDECL */
if( cfunc->calltype == CFUNC_CDECL
#ifndef FUNC_STDCALL