Permalink
Browse files

should check the argument

  • Loading branch information...
1 parent 851f216 commit a2f9d4932697c6c5ff665ad4337620ba2f1ecc68 @Watson1978 Watson1978 committed Jul 15, 2012
Showing with 10 additions and 9 deletions.
  1. +1 −0 class.c
  2. +4 −4 complex.c
  3. +5 −4 rational.c
  4. +0 −1 spec/frozen/tags/macruby/core/module/include_tags.txt
View
@@ -779,6 +779,7 @@ rb_mod_included_modules(VALUE mod)
VALUE
rb_mod_include_p(VALUE mod, SEL sel, VALUE mod2)
{
+ Check_Type(mod2, T_MODULE);
return rb_ary_includes(rb_mod_included_modules(mod), mod2);
}
View
@@ -1322,10 +1322,10 @@ static VALUE
nucomp_marshal_load(VALUE self, SEL sel, VALUE a)
{
get_dat1(self);
- VALUE ary = rb_convert_type(a, T_ARRAY, "Array", "to_ary");
- GC_WB(&dat->real, RARRAY_AT(ary, 0));
- GC_WB(&dat->imag, RARRAY_AT(ary, 1));
- rb_copy_generic_ivar(self, ary);
+ Check_Type(a, T_ARRAY);
+ GC_WB(&dat->real, RARRAY_AT(a, 0));
+ GC_WB(&dat->imag, RARRAY_AT(a, 1));
+ rb_copy_generic_ivar(self, a);
return self;
}
View
@@ -1583,10 +1583,11 @@ static VALUE
nurat_marshal_load(VALUE self, SEL sel, VALUE a)
{
get_dat1(self);
- VALUE ary = rb_convert_type(a, T_ARRAY, "Array", "to_ary");
- GC_WB(&dat->num, RARRAY_AT(ary, 0));
- GC_WB(&dat->den, RARRAY_AT(ary ,1));
- rb_copy_generic_ivar(self, ary);
+ Check_Type(a, T_ARRAY);
+ GC_WB(&dat->num, RARRAY_AT(a, 0));
+ GC_WB(&dat->den, RARRAY_AT(a ,1));
+ rb_copy_generic_ivar(self, a);
+
if (f_zero_p(dat->den)) {
rb_raise_zerodiv();
}
@@ -2,4 +2,3 @@ fails:Module#include adds all ancestor modules when a previously included module
fails:Module#include doesn't include module if it is included in a super class
fails:Module#include recursively includes new mixins
fails:Module#include preserves ancestor order
-fails:Module#include? raises a TypeError when no module was given

0 comments on commit a2f9d49

Please sign in to comment.