diff options
author | ttate <ttate@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2003-10-22 14:29:20 +0000 |
---|---|---|
committer | ttate <ttate@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2003-10-22 14:29:20 +0000 |
commit | 79c3e2d004c40449e987c1fb78602b7f3a93bd6a (patch) | |
tree | 4e8c91777a8996573aa8ab6655ec23bed61d58b0 /ext/dl | |
parent | f136a3225e5fdd37961b8ed0e29c96e4a40f0d64 (diff) |
Bugfix for PR#1196
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@4831 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'ext/dl')
-rw-r--r-- | ext/dl/ptr.c | 13 |
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; |