Changeset 124

Show
Ignore:
Timestamp:
01/20/2007 19:21:41 (22 months ago)
Author:
lwu
Message:

Check VALUE type before calling sandbox_import_class_path

Files:
1 modified

Legend:

Unmodified
Added
Removed
  • trunk/ext/sand_table/sand_table.c

    r114 r124  
    799799} 
    800800 
     801/* :nodoc: */ 
     802void 
     803check_import_type( klass ) 
     804  VALUE klass; 
     805{ 
     806  if (!(TYPE(klass) == T_CLASS || TYPE(klass) == T_MODULE)) 
     807  { 
     808    rb_raise(rb_eTypeError, "wrong argument type (expected Class or Module)"); 
     809  } 
     810} 
     811 
    801812/* 
    802813 *  call-seq: 
     
    812823  VALUE sandklass; 
    813824  sandkit *kit; 
     825  check_import_type( klass ); 
    814826  Data_Get_Struct( self, sandkit, kit ); 
    815827  sandklass = sandbox_import_class_path( kit, rb_class2name( klass ), 0 ); 
     
    829841{ 
    830842  sandkit *kit; 
     843  check_import_type( klass ); 
    831844  Data_Get_Struct( self, sandkit, kit ); 
    832845  sandbox_import_class_path( kit, rb_class2name( klass ), 1 );