mirror of
https://github.com/ruby/ruby.git
synced 2022-11-09 12:17:21 -05:00
* variable.c (autoload_data_type): typed.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@24812 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
parent
fe963a4510
commit
fb532ac7a9
2 changed files with 28 additions and 11 deletions
|
@ -1,4 +1,4 @@
|
|||
Wed Sep 9 12:56:56 2009 Nobuyoshi Nakada <nobu@ruby-lang.org>
|
||||
Wed Sep 9 13:09:07 2009 Nobuyoshi Nakada <nobu@ruby-lang.org>
|
||||
|
||||
* dir.c (dir_data_type): typed.
|
||||
|
||||
|
@ -16,6 +16,8 @@ Wed Sep 9 12:56:56 2009 Nobuyoshi Nakada <nobu@ruby-lang.org>
|
|||
|
||||
* transcode.c (econv_data_type): typed.
|
||||
|
||||
* variable.c (autoload_data_type): typed.
|
||||
|
||||
Wed Sep 9 11:11:33 2009 Nobuyoshi Nakada <nobu@ruby-lang.org>
|
||||
|
||||
* include/ruby/ruby.h (rb_data_type_struct): constified dsize.
|
||||
|
|
35
variable.c
35
variable.c
|
@ -292,7 +292,7 @@ rb_path_to_class(VALUE pathname)
|
|||
VALUE
|
||||
rb_path2class(const char *path)
|
||||
{
|
||||
return rb_path_to_class(rb_usascii_str_new_cstr(path));
|
||||
return rb_path_to_class(rb_str_new_cstr(path));
|
||||
}
|
||||
|
||||
void
|
||||
|
@ -1357,18 +1357,33 @@ rb_mod_const_missing(VALUE klass, VALUE name)
|
|||
return Qnil; /* not reached */
|
||||
}
|
||||
|
||||
static struct st_table *
|
||||
check_autoload_table(VALUE av)
|
||||
static void
|
||||
autoload_mark(void *ptr)
|
||||
{
|
||||
Check_Type(av, T_DATA);
|
||||
if (RDATA(av)->dmark != (RUBY_DATA_FUNC)rb_mark_tbl ||
|
||||
RDATA(av)->dfree != (RUBY_DATA_FUNC)st_free_table) {
|
||||
VALUE desc = rb_inspect(av);
|
||||
rb_raise(rb_eTypeError, "wrong autoload table: %s", RSTRING_PTR(desc));
|
||||
}
|
||||
return (struct st_table *)DATA_PTR(av);
|
||||
rb_mark_tbl((st_table *)ptr);
|
||||
}
|
||||
|
||||
static void
|
||||
autoload_free(void *ptr)
|
||||
{
|
||||
st_free_table((st_table *)ptr);
|
||||
}
|
||||
|
||||
static size_t
|
||||
autoload_memsize(const void *ptr)
|
||||
{
|
||||
const st_table *tbl = ptr;
|
||||
return st_memsize(tbl);
|
||||
}
|
||||
|
||||
static const rb_data_type_t autoload_data_type = {
|
||||
"autoload",
|
||||
autoload_mark, autoload_free, autoload_memsize,
|
||||
};
|
||||
|
||||
#define check_autoload_table(av) \
|
||||
(struct st_table *)rb_check_typeddata(av, &autoload_data_type)
|
||||
|
||||
void
|
||||
rb_autoload(VALUE mod, ID id, const char *file)
|
||||
{
|
||||
|
|
Loading…
Add table
Reference in a new issue