summaryrefslogtreecommitdiff
path: root/ext/dl/ptr.c
diff options
context:
space:
mode:
Diffstat (limited to 'ext/dl/ptr.c')
-rw-r--r--ext/dl/ptr.c13
1 files changed, 5 insertions, 8 deletions
diff --git a/ext/dl/ptr.c b/ext/dl/ptr.c
index 1eb0b82730..32f78c4de5 100644
--- a/ext/dl/ptr.c
+++ b/ext/dl/ptr.c
@@ -340,18 +340,14 @@ rb_dlptr_to_array(int argc, VALUE argv[], VALUE self)
case 'D':
n = data->size / sizeof(double);
break;
- case 'S': case 'P':
+ case 'P': case 'p':
n = data->size / sizeof(void*);
break;
+ case 'S': case 's':
+ for (n=0; ((void**)(data->ptr))[n]; n++) {};
+ break;
default:
- if (t == 'p' || t == 's') {
- int i;
- for (i=0; ((void**)(data->ptr))[i]; i++) {};
- n = i;
- }
- else{
n = 0;
- }
}
break;
default:
@@ -376,6 +372,7 @@ rb_dlptr_to_array(int argc, VALUE argv[], VALUE self)
break;
case 'D':
rb_ary_push(ary, rb_float_new(((double*)(data->ptr))[i]));
+ break;
case 'F':
rb_ary_push(ary, rb_float_new(((float*)(data->ptr))[i]));
break;