diff options
author | Kaz Kylheku <kaz@kylheku.com> | 2016-01-10 12:30:04 -0800 |
---|---|---|
committer | Kaz Kylheku <kaz@kylheku.com> | 2016-01-10 12:30:04 -0800 |
commit | b83af9a85c36d77110d66f60afdcdd41d17d3fae (patch) | |
tree | 94a12be490b79d853c281ea803958555c6807cef /parser.c | |
parent | 866c357da7ef1a2cb45290cb11ef91eb57b10169 (diff) | |
download | txr-b83af9a85c36d77110d66f60afdcdd41d17d3fae.tar.gz txr-b83af9a85c36d77110d66f60afdcdd41d17d3fae.tar.bz2 txr-b83af9a85c36d77110d66f60afdcdd41d17d3fae.zip |
New internal function scat: variable arg cat_str.
Avoids consing up list of strings.
* lib.c (vscat): New static function.
(scat): New function.
(lazy_str): Use scat instead of cat_str.
* lib.h (scat): Declared.
* eval.c (format_field): Use scat instead of cat_str.
* parser.c (open_txr_file, read_eval_stream): Likewise.
Diffstat (limited to 'parser.c')
-rw-r--r-- | parser.c | 6 |
1 files changed, 3 insertions, 3 deletions
@@ -235,7 +235,7 @@ void open_txr_file(val spec_file, val *txr_lisp_p, val *name, val *stream) #endif if (suffix == none && in == 0 && !*txr_lisp_p) { - spec_file_try = cat_str(list(spec_file, lit("txr"), nao), lit(".")); + spec_file_try = scat(lit("."), spec_file, lit("txr"), nao); in = w_fopen(c_str(spec_file_try), L"r"); #ifdef ENOENT if (in == 0 && errno != ENOENT) @@ -246,7 +246,7 @@ void open_txr_file(val spec_file, val *txr_lisp_p, val *name, val *stream) if (suffix == none && in == 0) { - spec_file_try = cat_str(list(spec_file, lit("tl"), nao), lit(".")); + spec_file_try = scat(lit("."), spec_file, lit("tl"), nao); in = w_fopen(c_str(spec_file_try), L"r"); *txr_lisp_p = t; } @@ -369,7 +369,7 @@ val read_eval_stream(val stream, val error_stream, val hash_bang_support) val firstline = get_line(stream); if (firstline && !match_str(firstline, lit("#!"), nil)) { - val flwnl = cat_str(list(firstline, lit("\n"), nao), nil); + val flwnl = scat(nil, firstline, lit("\n"), nao); val string_stream = make_string_byte_input_stream(flwnl); stream = make_catenated_stream(list(string_stream, stream, nao)); } |