From b83af9a85c36d77110d66f60afdcdd41d17d3fae Mon Sep 17 00:00:00 2001 From: Kaz Kylheku Date: Sun, 10 Jan 2016 12:30:04 -0800 Subject: 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. --- parser.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) (limited to 'parser.c') diff --git a/parser.c b/parser.c index 95f61012..fe5527b2 100644 --- a/parser.c +++ b/parser.c @@ -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)); } -- cgit v1.2.3