diff options
author | ttate <ttate@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2002-04-11 09:38:26 +0000 |
---|---|---|
committer | ttate <ttate@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2002-04-11 09:38:26 +0000 |
commit | 3a202ff2b4b39e910c7b99e2993ac5e5e12f2ad1 (patch) | |
tree | 1c4a9ad4faeee42031e163d1853d83c7b383c995 /ext/dl | |
parent | 3bd7404423c8a89297b52ff9496fa10b86d64046 (diff) | |
download | ruby-3a202ff2b4b39e910c7b99e2993ac5e5e12f2ad1.tar.gz |
raise() -> rb_raise(). (Thanks Tetsuya Watanabe)
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@2361 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'ext/dl')
-rw-r--r-- | ext/dl/ptr.c | 26 | ||||
-rw-r--r-- | ext/dl/sym.c | 4 | ||||
-rw-r--r-- | ext/dl/test/test.rb | 2 |
3 files changed, 13 insertions, 19 deletions
diff --git a/ext/dl/ptr.c b/ext/dl/ptr.c index 7a4d0c8e62..7a62c0d410 100644 --- a/ext/dl/ptr.c +++ b/ext/dl/ptr.c @@ -549,7 +549,7 @@ rb_dlptr_define_data_type(int argc, VALUE argv[], VALUE self) return Qnil; } else{ - raise(rb_eArgError, "wrong arguments"); + rb_raise(rb_eArgError, "wrong arguments"); }; }; @@ -687,7 +687,7 @@ cary2ary(void *ptr, char t, int len) elem = INT2NUM(*((short*)ptr)); ptr = (char *)ptr + sizeof(short); default: - raise(rb_eDLTypeError, "unsupported type '%c'", t); + rb_raise(rb_eDLTypeError, "unsupported type '%c'", t); }; return elem; }; @@ -723,7 +723,7 @@ cary2ary(void *ptr, char t, int len) elem = INT2NUM(*((short*)ptr)); ptr = (char *)ptr + sizeof(short); default: - raise(rb_eDLTypeError, "unsupported type '%c'", t); + rb_raise(rb_eDLTypeError, "unsupported type '%c'", t); }; rb_ary_push(ary, elem); }; @@ -746,7 +746,8 @@ rb_dlptr_aref(int argc, VALUE argv[], VALUE self) }; if( TYPE(key) == T_FIXNUM || TYPE(key) == T_BIGNUM ){ - VALUE pass[] = {num}; + VALUE pass[1]; + pass[0] = num; return rb_dlptr_to_str(1, pass, rb_dlptr_plus(self, key)); }; @@ -782,41 +783,34 @@ rb_dlptr_aref(int argc, VALUE argv[], VALUE self) DLALIGN(data->ptr,offset,SHORT_ALIGN); break; default: - raise(rb_eDLTypeError, "unsupported type '%c'", data->stype[i]); + rb_raise(rb_eDLTypeError, "unsupported type '%c'", data->stype[i]); }; return cary2ary((char *)data->ptr + offset, data->stype[i], data->ssize[i]); }; switch( data->stype[i] ){ case 'I': - case 'i': offset += sizeof(int) * data->ssize[i]; break; case 'L': - case 'l': offset += sizeof(long) * data->ssize[i]; break; case 'P': - case 'p': offset += sizeof(void*) * data->ssize[i]; break; case 'F': - case 'f': offset += sizeof(float) * data->ssize[i]; break; case 'D': - case 'd': offset += sizeof(double) * data->ssize[i]; break; case 'C': - case 'c': offset += sizeof(char) * data->ssize[i]; break; case 'H': - case 'h': offset += sizeof(short) * data->ssize[i]; break; default: - raise(rb_eDLTypeError, "unsupported type '%c'", data->stype[i]); + rb_raise(rb_eDLTypeError, "unsupported type '%c'", data->stype[i]); }; }; break; @@ -918,7 +912,7 @@ rb_dlptr_aset(int argc, VALUE argv[], VALUE self) DLALIGN(data->ptr,offset,SHORT_ALIGN); break; default: - raise(rb_eDLTypeError, "unsupported type '%c'", data->stype[i]); + rb_raise(rb_eDLTypeError, "unsupported type '%c'", data->stype[i]); }; memimg = ary2cary(data->stype[i], val, &memsize); memcpy((char *)data->ptr + offset, memimg, memsize); @@ -954,7 +948,7 @@ rb_dlptr_aset(int argc, VALUE argv[], VALUE self) offset += sizeof(short) * data->ssize[i]; break; default: - raise(rb_eDLTypeError, "unsupported type '%c'", data->stype[i]); + rb_raise(rb_eDLTypeError, "unsupported type '%c'", data->stype[i]); }; }; return val; @@ -985,7 +979,7 @@ rb_dlptr_aset(int argc, VALUE argv[], VALUE self) memsize = sizeof(short) * data->ssize[i]; break; default: - raise(rb_eDLTypeError, "unsupported type '%c'", data->stype[i]); + rb_raise(rb_eDLTypeError, "unsupported type '%c'", data->stype[i]); }; memimg = ary2cary(data->stype[i], val, NULL); memcpy(data->ptr, memimg, memsize); diff --git a/ext/dl/sym.c b/ext/dl/sym.c index 137b47525a..7f9793fa51 100644 --- a/ext/dl/sym.c +++ b/ext/dl/sym.c @@ -410,7 +410,7 @@ rb_dlsym_call(int argc, VALUE argv[], VALUE self) } else{ if( TYPE(argv[i]) != T_STRING ){ - raise(rb_eDLError, "#%d must be a string",i); + rb_raise(rb_eDLError, "#%d must be a string",i); }; ANY2S(args[i]) = DLSTR(RSTRING(argv[i])->ptr); }; @@ -418,7 +418,7 @@ rb_dlsym_call(int argc, VALUE argv[], VALUE self) break; case 's': if( TYPE(argv[i]) != T_STRING ){ - raise(rb_eDLError, "#%d must be a string",i); + rb_raise(rb_eDLError, "#%d must be a string",i); }; ANY2S(args[i]) = DLSTR(dlmalloc(RSTRING(argv[i])->len + 1)); memcpy((char*)(ANY2S(args[i])), RSTRING(argv[i])->ptr, RSTRING(argv[i])->len + 1); diff --git a/ext/dl/test/test.rb b/ext/dl/test/test.rb index 91ae1f6730..cd63ff190e 100644 --- a/ext/dl/test/test.rb +++ b/ext/dl/test/test.rb @@ -237,7 +237,7 @@ set_val = h["test_set_long_value","0"] get_val = h["test_get_long_value","L"] lval = get_val[][0] ptr = h["internal_long_value"] -ptr.struct!("l", :l) +ptr.struct!("L", :l) assert("get value", :must, ptr["l"] == lval) assert("get value", :must, ptr[:l] == lval) unless (Fixnum === :-) ptr["l"] = 200 |