summaryrefslogtreecommitdiffstats
path: root/stream.c
diff options
context:
space:
mode:
authorKaz Kylheku <kaz@kylheku.com>2009-11-02 13:58:30 -0800
committerKaz Kylheku <kaz@kylheku.com>2009-11-02 13:58:30 -0800
commit6191fbb2ca7a9ac339dd3994bdea8273ceb0a24d (patch)
tree3ddb47f26c66c5e4d09dd87f4518468f489f84a3 /stream.c
parent4b493073a6deafa6b4ac6386a0eab034e0e20082 (diff)
downloadtxr-6191fbb2ca7a9ac339dd3994bdea8273ceb0a24d.tar.gz
txr-6191fbb2ca7a9ac339dd3994bdea8273ceb0a24d.tar.bz2
txr-6191fbb2ca7a9ac339dd3994bdea8273ceb0a24d.zip
Start of implementation for freestyle matching.
Lazy strings implemented, incompletely. Changed string function to implicitly strdup; non-strdup version changed to string_own. Fixed wrong uses of strdup rather than chk_strdup. Functions added to regex module to provide regex matching as a state machine to which characters are fed.
Diffstat (limited to 'stream.c')
-rw-r--r--stream.c6
1 files changed, 3 insertions, 3 deletions
diff --git a/stream.c b/stream.c
index f91ae753..90932b0e 100644
--- a/stream.c
+++ b/stream.c
@@ -152,7 +152,7 @@ static obj_t *stdio_get_line(obj_t *stream)
char *line = snarf_line((FILE *) stream->co.handle);
if (!line)
return nil;
- return string(line);
+ return string_own(line);
}
}
@@ -407,7 +407,7 @@ static obj_t *dir_get_line(obj_t *stream)
return nil;
if (!strcmp(e->d_name, ".") || !strcmp(e->d_name, ".."))
continue;
- return string(chk_strdup(e->d_name));
+ return string(e->d_name);
}
}
}
@@ -478,7 +478,7 @@ obj_t *get_string_from_stream(obj_t *stream)
return out;
so->buf = chk_realloc(so->buf, so->fill + 1);
- out = string(so->buf);
+ out = string_own(so->buf);
free(so);
return out;
} else if (stream->co.ops == &string_in_ops.cobj_ops) {