diff options
author | Kaz Kylheku <kaz@kylheku.com> | 2015-06-08 19:36:31 -0700 |
---|---|---|
committer | Kaz Kylheku <kaz@kylheku.com> | 2015-06-08 19:36:31 -0700 |
commit | 9cf7180096f4a0f97437a5e159d8f7ac6542580c (patch) | |
tree | 174db1830156cd233f0c85dac9cf75cb2909e4e5 | |
parent | b50fa12ce36728c4bcc5a5ee7b0717ccedaef87b (diff) | |
download | txr-9cf7180096f4a0f97437a5e159d8f7ac6542580c.tar.gz txr-9cf7180096f4a0f97437a5e159d8f7ac6542580c.tar.bz2 txr-9cf7180096f4a0f97437a5e159d8f7ac6542580c.zip |
Code simplification.
* txr.c (txr_main): Replacing two code blocks with single
call to existing open_txr_file function.
-rw-r--r-- | ChangeLog | 7 | ||||
-rw-r--r-- | txr.c | 12 |
2 files changed, 9 insertions, 10 deletions
@@ -1,3 +1,10 @@ +2015-06-08 Kaz Kylheku <kaz@kylheku.com> + + Code simplification. + + * txr.c (txr_main): Replacing two code blocks with single + call to existing open_txr_file function. + 2015-06-07 Kaz Kylheku <kaz@kylheku.com> Critical bugfix for weak hashes. @@ -631,11 +631,7 @@ int txr_main(int argc, char **argv) arg_list = arg_undo; } else if (spec_file) { if (wcscmp(c_str(spec_file), L"-") != 0) { - FILE *in = w_fopen(c_str(spec_file), L"r"); - if (in == 0) - uw_throwf(file_error_s, lit("unable to open ~a"), spec_file, nao); - parse_stream = make_stdio_stream(in, spec_file); - spec_file_str = spec_file; + open_txr_file(spec_file, &spec_file_str, &parse_stream); } else { spec_file_str = lit("stdin"); } @@ -650,11 +646,7 @@ int txr_main(int argc, char **argv) } if (!equal(arg, lit("-"))) { - FILE *in = w_fopen(c_str(arg), L"r"); - if (in == 0) - uw_throwf(file_error_s, lit("unable to open ~a"), arg, nao); - parse_stream = make_stdio_stream(in, arg); - spec_file_str = arg; + open_txr_file(arg, &spec_file_str, &parse_stream); } else { spec_file_str = lit("stdin"); } |