Shrink ruby_cmdline_options_t
a bit
This commit is contained in:
parent
1e7b67f733
commit
1c2a4d9682
Notes:
git
2023-07-13 13:59:46 +00:00
@ -27,7 +27,8 @@ typedef struct ruby_cmdline_options {
|
|||||||
struct rb_rjit_options rjit;
|
struct rb_rjit_options rjit;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
int sflag, xflag;
|
signed int sflag: 2;
|
||||||
|
unsigned int xflag: 1;
|
||||||
unsigned int warning: 1;
|
unsigned int warning: 1;
|
||||||
unsigned int verbose: 1;
|
unsigned int verbose: 1;
|
||||||
unsigned int do_loop: 1;
|
unsigned int do_loop: 1;
|
||||||
|
21
ruby.c
21
ruby.c
@ -811,10 +811,10 @@ toplevel_context(rb_binding_t *bind)
|
|||||||
return &bind->block;
|
return &bind->block;
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static int
|
||||||
process_sflag(int *sflag)
|
process_sflag(int sflag)
|
||||||
{
|
{
|
||||||
if (*sflag > 0) {
|
if (sflag > 0) {
|
||||||
long n;
|
long n;
|
||||||
const VALUE *args;
|
const VALUE *args;
|
||||||
VALUE argv = rb_argv;
|
VALUE argv = rb_argv;
|
||||||
@ -871,8 +871,9 @@ process_sflag(int *sflag)
|
|||||||
while (n--) {
|
while (n--) {
|
||||||
rb_ary_shift(argv);
|
rb_ary_shift(argv);
|
||||||
}
|
}
|
||||||
*sflag = -1;
|
return -1;
|
||||||
}
|
}
|
||||||
|
return sflag;
|
||||||
}
|
}
|
||||||
|
|
||||||
static long proc_options(long argc, char **argv, ruby_cmdline_options_t *opt, int envopt);
|
static long proc_options(long argc, char **argv, ruby_cmdline_options_t *opt, int envopt);
|
||||||
@ -2203,7 +2204,7 @@ process_options(int argc, char **argv, ruby_cmdline_options_t *opt)
|
|||||||
#undef SET_COMPILE_OPTION
|
#undef SET_COMPILE_OPTION
|
||||||
}
|
}
|
||||||
ruby_set_argv(argc, argv);
|
ruby_set_argv(argc, argv);
|
||||||
process_sflag(&opt->sflag);
|
opt->sflag = process_sflag(opt->sflag);
|
||||||
|
|
||||||
if (opt->e_script) {
|
if (opt->e_script) {
|
||||||
VALUE progname = rb_progname;
|
VALUE progname = rb_progname;
|
||||||
@ -2233,7 +2234,9 @@ process_options(int argc, char **argv, ruby_cmdline_options_t *opt)
|
|||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
VALUE f;
|
VALUE f;
|
||||||
f = open_load_file(script_name, &opt->xflag);
|
int xflag = opt->xflag;
|
||||||
|
f = open_load_file(script_name, &xflag);
|
||||||
|
opt->xflag = xflag != 0;
|
||||||
rb_parser_set_context(parser, 0, f == rb_stdin);
|
rb_parser_set_context(parser, 0, f == rb_stdin);
|
||||||
ast = load_file(parser, opt->script_name, f, 1, opt);
|
ast = load_file(parser, opt->script_name, f, 1, opt);
|
||||||
}
|
}
|
||||||
@ -2265,7 +2268,7 @@ process_options(int argc, char **argv, ruby_cmdline_options_t *opt)
|
|||||||
return Qfalse;
|
return Qfalse;
|
||||||
}
|
}
|
||||||
|
|
||||||
process_sflag(&opt->sflag);
|
opt->sflag = process_sflag(opt->sflag);
|
||||||
opt->xflag = 0;
|
opt->xflag = 0;
|
||||||
|
|
||||||
if (dump & DUMP_BIT(syntax)) {
|
if (dump & DUMP_BIT(syntax)) {
|
||||||
@ -2636,7 +2639,9 @@ void *
|
|||||||
rb_parser_load_file(VALUE parser, VALUE fname_v)
|
rb_parser_load_file(VALUE parser, VALUE fname_v)
|
||||||
{
|
{
|
||||||
ruby_cmdline_options_t opt;
|
ruby_cmdline_options_t opt;
|
||||||
VALUE f = open_load_file(fname_v, &cmdline_options_init(&opt)->xflag);
|
int xflag = 0;
|
||||||
|
VALUE f = open_load_file(fname_v, &xflag);
|
||||||
|
cmdline_options_init(&opt)->xflag = xflag != 0;
|
||||||
return load_file(parser, fname_v, f, 0, &opt);
|
return load_file(parser, fname_v, f, 0, &opt);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user