Project

General

Profile

Feature #11664 ยป 0001-introduce-rb_autoload_value-to-replace-rb_autoload.patch

normalperson (Eric Wong), 11/06/2015 03:54 AM

View differences:

include/ruby/intern.h
VALUE rb_path2class(const char*);
void rb_name_class(VALUE, ID);
VALUE rb_class_name(VALUE);
void rb_autoload(VALUE, ID, const char*);
DEPRECATED(void rb_autoload(VALUE, ID, const char*));
VALUE rb_autoload_load(VALUE, ID);
VALUE rb_autoload_p(VALUE, ID);
VALUE rb_f_trace_var(int, const VALUE*);
internal.h
VALUE rb_search_class_path(VALUE);
VALUE rb_attr_delete(VALUE, ID);
VALUE rb_ivar_lookup(VALUE obj, ID id, VALUE undef);
void rb_autoload_value(VALUE mod, ID id, VALUE file);
/* version.c */
extern VALUE ruby_engine_name;
load.c
ID id = rb_to_id(sym);
FilePathValue(file);
rb_autoload(mod, id, RSTRING_PTR(file));
rb_autoload_value(mod, id, file);
return Qnil;
}
variable.c
void
rb_autoload(VALUE mod, ID id, const char *file)
{
if (!file || !*file) {
rb_raise(rb_eArgError, "empty file name");
}
rb_autoload_value(mod, id, rb_fstring_cstr(file));
}
void
rb_autoload_value(VALUE mod, ID id, VALUE file)
{
st_data_t av;
VALUE ad, fn;
VALUE ad;
struct st_table *tbl;
struct autoload_data_i *ele;
rb_const_entry_t *ce;
......
rb_raise(rb_eNameError, "autoload must be constant name: %"PRIsVALUE"",
QUOTE_ID(id));
}
if (!file || !*file) {
Check_Type(file, T_STRING);
if (!RSTRING_LEN(file)) {
rb_raise(rb_eArgError, "empty file name");
}
......
RB_OBJ_WRITTEN(mod, Qnil, av);
DATA_PTR(av) = tbl = st_init_numtable();
}
fn = rb_str_new2(file);
FL_UNSET(fn, FL_TAINT);
OBJ_FREEZE(fn);
ad = TypedData_Make_Struct(0, struct autoload_data_i, &autoload_data_i_type, ele);
ele->feature = fn;
if (OBJ_TAINTED(file)) {
file = rb_str_dup(file);
FL_UNSET(file, FL_TAINT);
}
ele->feature = rb_fstring(file);
ele->safe_level = rb_safe_level();
ele->value = Qundef;
ele->state = 0;
-
    (1-1/1)