mirror of
				https://github.com/ruby/ruby.git
				synced 2022-11-09 12:17:21 -05:00 
			
		
		
		
	* variable.c (rb_autoload_load): checks if iv_tbl is valid.
[ruby-dev:38456] git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@23431 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
		
							parent
							
								
									f7c9c76769
								
							
						
					
					
						commit
						f4a0a73175
					
				
					 3 changed files with 26 additions and 8 deletions
				
			
		| 
						 | 
				
			
			@ -1,3 +1,8 @@
 | 
			
		|||
Fri May 15 15:15:12 2009  Nobuyoshi Nakada  <nobu@ruby-lang.org>
 | 
			
		||||
 | 
			
		||||
	* variable.c (rb_autoload_load): checks if iv_tbl is valid.
 | 
			
		||||
	  [ruby-dev:38456]
 | 
			
		||||
 | 
			
		||||
Fri May 15 11:17:48 2009  NAKAMURA Usaku  <usa@ruby-lang.org>
 | 
			
		||||
 | 
			
		||||
	* win32/setup.mak (-version-): now version.h includes
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -144,3 +144,9 @@ assert_equal '3', %q{
 | 
			
		|||
  }
 | 
			
		||||
  $i
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
assert_match /::C\z/, %q{
 | 
			
		||||
  c = nil
 | 
			
		||||
  Module.new{|m| c = class m::C; name; end}
 | 
			
		||||
  c
 | 
			
		||||
}, '[ruby-dev:38456]'
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
							
								
								
									
										23
									
								
								variable.c
									
										
									
									
									
								
							
							
						
						
									
										23
									
								
								variable.c
									
										
									
									
									
								
							| 
						 | 
				
			
			@ -1432,11 +1432,23 @@ autoload_node(VALUE mod, ID id, int noload)
 | 
			
		|||
    return 0;
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
static NODE *
 | 
			
		||||
autoload_node_ptr(VALUE mod, ID id)
 | 
			
		||||
{
 | 
			
		||||
    struct st_table *tbl = RCLASS_IV_TBL(mod);
 | 
			
		||||
    st_data_t val;
 | 
			
		||||
 | 
			
		||||
    if (!tbl || !st_lookup(tbl, id, &val) || val != Qundef) {
 | 
			
		||||
	return 0;
 | 
			
		||||
    }
 | 
			
		||||
    return autoload_node(mod, id, 0);
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
VALUE
 | 
			
		||||
rb_autoload_load(VALUE klass, ID id)
 | 
			
		||||
{
 | 
			
		||||
    VALUE file;
 | 
			
		||||
    NODE *load = autoload_node(klass, id, 0);
 | 
			
		||||
    NODE *load = autoload_node_ptr(klass, id);
 | 
			
		||||
 | 
			
		||||
    if (!load) return Qfalse;
 | 
			
		||||
    file = load->nd_lit;
 | 
			
		||||
| 
						 | 
				
			
			@ -1446,15 +1458,10 @@ rb_autoload_load(VALUE klass, ID id)
 | 
			
		|||
VALUE
 | 
			
		||||
rb_autoload_p(VALUE mod, ID id)
 | 
			
		||||
{
 | 
			
		||||
    struct st_table *tbl = RCLASS_IV_TBL(mod);
 | 
			
		||||
    st_data_t val;
 | 
			
		||||
    NODE *load;
 | 
			
		||||
    VALUE file;
 | 
			
		||||
    NODE *load = autoload_node_ptr(mod, id);
 | 
			
		||||
 | 
			
		||||
    if (!tbl || !st_lookup(tbl, id, &val) || val != Qundef) {
 | 
			
		||||
	return Qnil;
 | 
			
		||||
    }
 | 
			
		||||
    load = autoload_node(mod, id, 0);
 | 
			
		||||
    if (!load) return Qnil;
 | 
			
		||||
    return load && (file = load->nd_lit) ? file : Qnil;
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue