Commit 02d4949d authored by cremno's avatar cremno Committed by Yukihiro "Matz" Matsumoto

initialize `args` in `parse_args`

parent a0912df6
...@@ -39,10 +39,12 @@ print_usage(const char *f) ...@@ -39,10 +39,12 @@ print_usage(const char *f)
static int static int
parse_args(int argc, char **argv, struct strip_args *args) parse_args(int argc, char **argv, struct strip_args *args)
{ {
static const struct strip_args initial_args = {0};
int i; int i;
*args = initial_args; args->argc_start = 0;
args->argc = argc;
args->argv = argv;
args->lvar = FALSE;
for (i = 1; i < argc; ++i) { for (i = 1; i < argc; ++i) {
const size_t len = strlen(argv[i]); const size_t len = strlen(argv[i]);
...@@ -65,6 +67,7 @@ parse_args(int argc, char **argv, struct strip_args *args) ...@@ -65,6 +67,7 @@ parse_args(int argc, char **argv, struct strip_args *args)
} }
} }
args->argc_start = i;
return i; return i;
} }
...@@ -139,11 +142,6 @@ main(int argc, char **argv) ...@@ -139,11 +142,6 @@ main(int argc, char **argv)
print_usage(argv[0]); print_usage(argv[0]);
return EXIT_FAILURE; return EXIT_FAILURE;
} }
args.argc_start = args_result;
args.argc = argc;
args.argv = argv;
mrb = mrb_open(); mrb = mrb_open();
if (mrb == NULL) { if (mrb == NULL) {
fputs("Invalid mrb_state, exiting mruby-strip\n", stderr); fputs("Invalid mrb_state, exiting mruby-strip\n", stderr);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment