aboutsummaryrefslogtreecommitdiff
path: root/Lib
diff options
context:
space:
mode:
authorLogan Johnson <ljohnson@users.sourceforge.net>2003-04-25 20:00:46 +0000
committerLogan Johnson <ljohnson@users.sourceforge.net>2003-04-25 20:00:46 +0000
commit542091e9296a506a721824d508eecc0aae85ed92 (patch)
tree7fceb426c1dd05e6530dc52ce8ba7674c646a49d /Lib
parent8fb4c9fceb1738c6ce4cd77d1aea3059cdde8e27 (diff)
downloadswig-542091e9296a506a721824d508eecc0aae85ed92.tar.gz
Made a change to the type-checking code in SWIG_ConvertPtr() for the Ruby
module, so that the new multiple-inheritance support code will work. git-svn-id: https://swig.svn.sourceforge.net/svnroot/swig/trunk/SWIG@4708 626c5289-ae23-0410-ae9c-e8d60b6d4f22
Diffstat (limited to 'Lib')
-rw-r--r--Lib/ruby/rubydef.swg42
1 files changed, 19 insertions, 23 deletions
diff --git a/Lib/ruby/rubydef.swg b/Lib/ruby/rubydef.swg
index 82fd3e980..3f34aef8b 100644
--- a/Lib/ruby/rubydef.swg
+++ b/Lib/ruby/rubydef.swg
@@ -93,30 +93,26 @@ SWIG_ConvertPtr(VALUE obj, void **ptr, swig_type_info *ty, int flags)
/* Do type-checking if type info was provided */
if (ty) {
if (ty->clientdata) {
- if (!rb_obj_is_kind_of(obj, ((swig_class *) (ty->clientdata))->klass)) {
- if (flags)
- rb_raise(rb_eTypeError, "wrong argument type (expected %s)", ty->str);
- else
- return -1;
- }
- if (*ptr == 0)
- rb_raise(rb_eRuntimeError, "This %s already released", ty->str);
- } else {
- if ((c = SWIG_MangleStr(obj)) == NULL) {
- if (flags)
- rb_raise(rb_eTypeError, "Expected %s", ty->str);
- else
- return -1;
- }
- tc = SWIG_TypeCheck(c, ty);
- if (!tc) {
- if (flags)
- rb_raise(rb_eTypeError, "Expected %s", ty->str);
- else
- return -1;
- }
- *ptr = SWIG_TypeCast(tc, *ptr);
+ if (rb_obj_is_kind_of(obj, ((swig_class *) (ty->clientdata))->klass)) {
+ if (*ptr == 0)
+ rb_raise(rb_eRuntimeError, "This %s already released", ty->str);
+ return 0;
+ }
+ }
+ if ((c = SWIG_MangleStr(obj)) == NULL) {
+ if (flags)
+ rb_raise(rb_eTypeError, "Expected %s", ty->str);
+ else
+ return -1;
+ }
+ tc = SWIG_TypeCheck(c, ty);
+ if (!tc) {
+ if (flags)
+ rb_raise(rb_eTypeError, "Expected %s", ty->str);
+ else
+ return -1;
}
+ *ptr = SWIG_TypeCast(tc, *ptr);
}
return 0;
}