summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--ChangeLog13
-rw-r--r--lib.c4
-rw-r--r--stream.c8
-rw-r--r--txr.c3
4 files changed, 20 insertions, 8 deletions
diff --git a/ChangeLog b/ChangeLog
index 1e46b46c..8c820750 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -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.
diff --git a/lib.c b/lib.c
index 48349c2e..0c60a4de 100644
--- a/lib.c
+++ b/lib.c
@@ -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);
}
diff --git a/stream.c b/stream.c
index 78c2598e..e4d4fc91 100644
--- a/stream.c
+++ b/stream.c
@@ -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();
diff --git a/txr.c b/txr.c
index 5ff5e2e0..bcf85f9d 100644
--- a/txr.c
+++ b/txr.c
@@ -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);
}