mirror of
https://github.com/ruby/ruby.git
synced 2022-11-09 12:17:21 -05:00
load.c: defer static linked init
* enc/encinit.c.erb (Init_enc): initialize encdb and transdb directly. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@48699 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
parent
673f1b3064
commit
638ba47303
3 changed files with 19 additions and 5 deletions
|
@ -1,3 +1,8 @@
|
|||
Wed Dec 3 16:47:35 2014 Nobuyoshi Nakada <nobu@ruby-lang.org>
|
||||
|
||||
* enc/encinit.c.erb (Init_enc): initialize encdb and transdb
|
||||
directly.
|
||||
|
||||
Wed Dec 3 14:51:26 2014 Nobuyoshi Nakada <nobu@ruby-lang.org>
|
||||
|
||||
* load.c (ruby_require_internal): separate from rb_require_safe,
|
||||
|
|
|
@ -8,19 +8,30 @@
|
|||
ruby_init_ext(name, func); \
|
||||
}
|
||||
|
||||
#define init_enc(name) init(Init_##name, "enc/"#name".so")
|
||||
#define init_trans(name) init(Init_trans_##name, "enc/trans/"#name".so")
|
||||
#define provide(func, name) { \
|
||||
extern void Init_##func(void); \
|
||||
Init_##func(); \
|
||||
rb_provide(name".so"); \
|
||||
}
|
||||
|
||||
void ruby_init_ext(const char *name, void (*init)(void));
|
||||
void rb_provide(const char *feature);
|
||||
|
||||
void
|
||||
Init_enc(void)
|
||||
{
|
||||
provide(encdb, "encdb");
|
||||
% ENCS.each do |enc|
|
||||
init(Init_<%= enc %>, "enc/<%= enc %>.so");
|
||||
% next if enc == 'encdb'
|
||||
init_enc(<%= enc %>);
|
||||
% end
|
||||
|
||||
init(Init_transdb, "enc/trans/transdb.so");
|
||||
provide(transdb, "trans/transdb");
|
||||
% TRANS.each do |trans|
|
||||
% next if trans == 'trans/transdb'
|
||||
init(Init_trans_<%= File.basename trans %>, "enc/<%= trans %>.so");
|
||||
init_trans(<%= File.basename trans %>);
|
||||
% end
|
||||
}
|
||||
<%# vim: set ft=eruby sw=2 : -%>
|
||||
|
|
2
load.c
2
load.c
|
@ -1077,7 +1077,6 @@ register_init_ext(st_data_t *key, st_data_t *value, st_data_t init, int existing
|
|||
else {
|
||||
*value = (st_data_t)NEW_MEMO(init, 0, 0);
|
||||
*key = (st_data_t)ruby_strdup(name);
|
||||
(*(void (*)(void))init)();
|
||||
}
|
||||
return ST_CONTINUE;
|
||||
}
|
||||
|
@ -1093,7 +1092,6 @@ ruby_init_ext(const char *name, void (*init)(void))
|
|||
GET_VM()->loading_table = loading_tbl = st_init_strtable();
|
||||
}
|
||||
st_update(loading_tbl, (st_data_t)name, register_init_ext, (st_data_t)init);
|
||||
rb_provide(name);
|
||||
}
|
||||
|
||||
/*
|
||||
|
|
Loading…
Reference in a new issue