diff options
-rw-r--r-- | ChangeLog | 13 | ||||
-rw-r--r-- | lib.c | 4 | ||||
-rw-r--r-- | stream.c | 8 | ||||
-rw-r--r-- | txr.c | 3 |
4 files changed, 20 insertions, 8 deletions
@@ -1,3 +1,16 @@ +2013-12-06 Kaz Kylheku <kaz@kylheku.com> + + Fixing some old-style coding that became obsolete + around November 2009. + + * lib.c (lazy_str): Use the efficient lit("...") that + doesn't allocate memory instead of string(L"..."). + (lazy_str_get_trailing_list): Likewise. + + * stream.c (open_process): Likewise. + + * txr.c (remove_hash_bang_line): Likewise. + 2013-12-05 Kaz Kylheku <kaz@kylheku.com> * regex.c (regex_compile): Handle string input. @@ -3896,7 +3896,7 @@ val lazy_str(val lst, val term, val limit) /* Must init before calling something that can gc! */ obj->ls.opts = obj->ls.list = obj->ls.prefix = nil; - term = or2(term, string(L"\n")); + term = or2(term, lit("\n")); if (nullp(lst)) { obj->ls.prefix = null_string; @@ -4053,7 +4053,7 @@ val lazy_str_get_trailing_list(val lstr, val index) { uses_or2; val split_suffix = split_str(sub_str(lstr->ls.prefix, index, nil), - or2(car(lstr->ls.opts), string(L"\n"))); + or2(car(lstr->ls.opts), lit("\n"))); return nappend2(split_suffix, lstr->ls.list); } @@ -1981,10 +1981,10 @@ val open_process(val name, val mode_str, val args) void stream_init(void) { protect(&std_input, &std_output, &std_debug, &std_error, &std_null, (val *) 0); - std_input = make_stdio_stream(stdin, string(L"stdin")); - std_output = make_stdio_stream(stdout, string(L"stdout")); - std_debug = make_stdio_stream(stdout, string(L"debug")); - std_error = make_stdio_stream(stderr, string(L"stderr")); + std_input = make_stdio_stream(stdin, lit("stdin")); + std_output = make_stdio_stream(stdout, lit("stdout")); + std_debug = make_stdio_stream(stdout, lit("debug")); + std_error = make_stdio_stream(stderr, lit("stderr")); std_null = make_null_stream(); detect_format_string(); @@ -131,7 +131,6 @@ static val remove_hash_bang_line(val spec) return spec; { - val shbang = string(L"#!"); val firstline = first(spec); val firstelem = first(firstline); val item; @@ -145,7 +144,7 @@ static val remove_hash_bang_line(val spec) if (stringp(item)) { val twochars = sub_str(item, zero, two); - if (equal(twochars, shbang)) + if (equal(twochars, lit("#!"))) return rest(spec); } |