summaryrefslogtreecommitdiff
path: root/ruby.c
diff options
context:
space:
mode:
authornobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2007-10-19 02:09:57 +0000
committernobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2007-10-19 02:09:57 +0000
commita4e493a98547f3511bb35d942bf84e585f4ae092 (patch)
tree8f2290604947894bb77e510ff10b5d1c124b5fd9 /ruby.c
parent572513527403b9dcac46764fcc9eec3a8430ea44 (diff)
* ruby.c (process_options): set primary encoding from the parser
always. [ruby-core:12758] * ruby.c (load_file): should not discard the parser parameter. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@13742 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'ruby.c')
-rw-r--r--ruby.c10
1 files changed, 1 insertions, 9 deletions
diff --git a/ruby.c b/ruby.c
index 97d5d38a56..ffdf45a151 100644
--- a/ruby.c
+++ b/ruby.c
@@ -842,7 +842,6 @@ process_options(VALUE arg)
char **argv = opt->argv;
NODE *tree = 0;
VALUE parser;
- VALUE encoding;
const char *s;
int i = proc_options(argc, argv, opt);
@@ -970,13 +969,7 @@ process_options(VALUE arg)
}
}
- if (opt->enc_index >= 0) {
- encoding = rb_enc_from_encoding(rb_enc_from_index(opt->enc_index));
- }
- else {
- encoding = rb_parser_encoding(parser);
- }
- rb_set_primary_encoding(encoding);
+ rb_set_primary_encoding(rb_parser_encoding(parser));
return (VALUE)tree;
}
@@ -1097,7 +1090,6 @@ load_file(VALUE parser, const char *fname, int script, struct cmdline_options *o
require_libraries(); /* Why here? unnatural */
}
if (opt->enc_index >= 0) rb_enc_associate_index(f, opt->enc_index);
- parser = rb_parser_new();
tree = (NODE *)rb_parser_compile_file(parser, fname, f, line_start);
if (script && rb_parser_end_seen_p(parser)) {
rb_define_global_const("DATA", f);