ruby-changes:11870
From: yugui <ko1@a...>
Date: Fri, 22 May 2009 18:48:39 +0900 (JST)
Subject: [ruby-changes:11870] Ruby:r23528 (ruby_1_9_1): merges r23440 from trunk into ruby_1_9_1.
yugui 2009-05-22 18:48:22 +0900 (Fri, 22 May 2009) New Revision: 23528 http://svn.ruby-lang.org/cgi-bin/viewvc.cgi?view=rev&revision=23528 Log: merges r23440 from trunk into ruby_1_9_1. -- * variable.c (rb_autoload_load): gets rid of false warning. [ruby-core:23466] Modified files: branches/ruby_1_9_1/ChangeLog branches/ruby_1_9_1/variable.c branches/ruby_1_9_1/version.h Index: ruby_1_9_1/ChangeLog =================================================================== --- ruby_1_9_1/ChangeLog (revision 23527) +++ ruby_1_9_1/ChangeLog (revision 23528) @@ -1,3 +1,8 @@ +Sat May 16 13:49:24 2009 Nobuyoshi Nakada <nobu@r...> + + * variable.c (rb_autoload_load): gets rid of false warning. + [ruby-core:23466] + Sat May 16 10:59:54 2009 Yukihiro Matsumoto <matz@r...> * sample/drb/dhasenc.rb: add magic comment for encoding. Index: ruby_1_9_1/variable.c =================================================================== --- ruby_1_9_1/variable.c (revision 23527) +++ ruby_1_9_1/variable.c (revision 23528) @@ -1399,7 +1399,7 @@ } static NODE * -autoload_node(VALUE mod, ID id, int noload) +autoload_node(VALUE mod, ID id, const char **loadingpath) { VALUE file; struct st_table *tbl; @@ -1424,14 +1424,15 @@ if (!rb_ensure(autoload_provided, (VALUE)&loading, reset_safe, (VALUE)safe)) { return load; } - if (!noload && loading) { + if (loadingpath && loading) { + *loadingpath = loading; return load; } return 0; } -static NODE * -autoload_node_ptr(VALUE mod, ID id) +static int +autoload_node_id(VALUE mod, ID id) { struct st_table *tbl = RCLASS_IV_TBL(mod); st_data_t val; @@ -1439,16 +1440,21 @@ if (!tbl || !st_lookup(tbl, id, &val) || val != Qundef) { return 0; } - return autoload_node(mod, id, 0); + return 1; } VALUE -rb_autoload_load(VALUE klass, ID id) +rb_autoload_load(VALUE mod, ID id) { VALUE file; - NODE *load = autoload_node_ptr(klass, id); + NODE *load; + const char *loading = 0, *src; + if (!autoload_node_id(mod, id)) return Qfalse; + load = autoload_node(mod, id, &loading); if (!load) return Qfalse; + src = rb_sourcefile(); + if (src && loading && strcmp(src, loading) == 0) return Qfalse; file = load->nd_lit; return rb_require_safe(file, load->nd_nth); } @@ -1457,8 +1463,11 @@ rb_autoload_p(VALUE mod, ID id) { VALUE file; - NODE *load = autoload_node_ptr(mod, id); + NODE *load; + const char *loading = 0; + if (!autoload_node_id(mod, id)) return Qnil; + load = autoload_node(mod, id, &loading); if (!load) return Qnil; return load && (file = load->nd_lit) ? file : Qnil; } @@ -1664,7 +1673,7 @@ retry: while (tmp) { if (RCLASS_IV_TBL(tmp) && st_lookup(RCLASS_IV_TBL(tmp), id, &value)) { - if (value == Qundef && !autoload_node(klass, id, 1)) + if (value == Qundef && !autoload_node(klass, id, 0)) return Qfalse; return Qtrue; } Index: ruby_1_9_1/version.h =================================================================== --- ruby_1_9_1/version.h (revision 23527) +++ ruby_1_9_1/version.h (revision 23528) @@ -1,6 +1,6 @@ #define RUBY_VERSION "1.9.1" #define RUBY_RELEASE_DATE "2009-05-12" -#define RUBY_PATCHLEVEL 142 +#define RUBY_PATCHLEVEL 143 #define RUBY_VERSION_MAJOR 1 #define RUBY_VERSION_MINOR 9 #define RUBY_VERSION_TEENY 1 -- ML: ruby-changes@q... Info: http://www.atdot.net/~ko1/quickml/