Commit 0f284091 authored by cremno's avatar cremno

delete mrb_free()-related non-NULL checks

No need to optimize since a program only exits once and errors are rare.
Also the mruby source code doesn't have these kind of checks elsewhere.

The ones in {Time,Random}#initialize are kept because there it actually
matters
since initialization always happens and re-initialization is unlikely.
parent 207577f0
......@@ -161,8 +161,7 @@ parse_args(mrb_state *mrb, int argc, char **argv, struct mrbc_args *args)
static void
cleanup(mrb_state *mrb, struct mrbc_args *args)
{
if (args->outfile)
mrb_free(mrb, (void*)args->outfile);
mrb_free(mrb, (void*)args->outfile);
mrb_close(mrb);
}
......
......@@ -159,10 +159,9 @@ cleanup(mrb_state *mrb, struct _args *args)
{
if (args->rfp && args->rfp != stdin)
fclose(args->rfp);
if (args->cmdline && !args->fname)
if (!args->fname)
mrb_free(mrb, args->cmdline);
if (args->argv)
mrb_free(mrb, args->argv);
mrb_free(mrb, args->argv);
mrb_close(mrb);
}
......
......@@ -978,12 +978,8 @@ error_exit:
mrb_free(mrb, *bin);
*bin = NULL;
}
if (lv_syms) {
mrb_free(mrb, lv_syms);
}
if (filenames) {
mrb_free(mrb, filenames);
}
mrb_free(mrb, lv_syms);
mrb_free(mrb, filenames);
return result;
}
......
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