mirror of
https://github.com/ruby/ruby.git
synced 2022-11-09 12:17:21 -05:00
* ruby.c (load_file_internal): cache common interned IDs.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@20012 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
parent
f68296698a
commit
bd92ab89c0
2 changed files with 9 additions and 3 deletions
|
@ -1,3 +1,7 @@
|
|||
Wed Oct 29 09:23:01 2008 Nobuyoshi Nakada <nobu@ruby-lang.org>
|
||||
|
||||
* ruby.c (load_file_internal): cache common interned IDs.
|
||||
|
||||
Wed Oct 29 00:43:39 2008 Tadayoshi Funaba <tadf@dotrb.org>
|
||||
|
||||
* complex.c: uses macro in declarations.
|
||||
|
|
8
ruby.c
8
ruby.c
|
@ -1223,6 +1223,7 @@ load_file_internal(VALUE arg)
|
|||
int line_start = 1;
|
||||
NODE *tree = 0;
|
||||
rb_encoding *enc;
|
||||
ID set_encoding;
|
||||
|
||||
if (!fname)
|
||||
rb_load_fail(fname);
|
||||
|
@ -1245,6 +1246,7 @@ load_file_internal(VALUE arg)
|
|||
f = rb_io_fdopen(fd, mode, fname);
|
||||
}
|
||||
|
||||
CONST_ID(set_encoding, "set_encoding");
|
||||
if (script) {
|
||||
VALUE c = 1; /* something not nil */
|
||||
VALUE line;
|
||||
|
@ -1254,7 +1256,7 @@ load_file_internal(VALUE arg)
|
|||
int no_int_enc = !opt->intern.enc.name;
|
||||
|
||||
enc = rb_usascii_encoding();
|
||||
rb_funcall(f, rb_intern("set_encoding"), 1, rb_enc_from_encoding(enc));
|
||||
rb_funcall(f, set_encoding, 1, rb_enc_from_encoding(enc));
|
||||
|
||||
if (opt->xflag) {
|
||||
forbid_setid("-x");
|
||||
|
@ -1356,9 +1358,9 @@ load_file_internal(VALUE arg)
|
|||
else {
|
||||
enc = rb_usascii_encoding();
|
||||
}
|
||||
rb_funcall(f, rb_intern("set_encoding"), 1, rb_enc_from_encoding(enc));
|
||||
rb_funcall(f, set_encoding, 1, rb_enc_from_encoding(enc));
|
||||
tree = (NODE *)rb_parser_compile_file(parser, fname, f, line_start);
|
||||
rb_funcall(f, rb_intern("set_encoding"), 1, rb_parser_encoding(parser));
|
||||
rb_funcall(f, set_encoding, 1, rb_parser_encoding(parser));
|
||||
if (script && rb_parser_end_seen_p(parser)) {
|
||||
rb_define_global_const("DATA", f);
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue