summaryrefslogtreecommitdiffstats
path: root/stream.c
diff options
context:
space:
mode:
authorKaz Kylheku <kaz@kylheku.com>2009-11-18 23:02:59 -0800
committerKaz Kylheku <kaz@kylheku.com>2009-11-18 23:02:59 -0800
commit61abd16ff59debebdacfe0de5050070b5dde46ee (patch)
tree2121409ef6d878412a9ecb71cf6134b1a6974ef3 /stream.c
parent9eddf1e4e0482ca8db81fcc4411fadd01190476c (diff)
downloadtxr-61abd16ff59debebdacfe0de5050070b5dde46ee.tar.gz
txr-61abd16ff59debebdacfe0de5050070b5dde46ee.tar.bz2
txr-61abd16ff59debebdacfe0de5050070b5dde46ee.zip
Following-up on diagnostics obtained by running code through C++
compiler. Idea: allocator functions return char * instead of void *, like malloc did in classic pre-ANSI C. That way we are forced to use a cast except when the target pointer is char * already.
Diffstat (limited to 'stream.c')
-rw-r--r--stream.c9
1 files changed, 5 insertions, 4 deletions
diff --git a/stream.c b/stream.c
index 21b3806f..d3168eec 100644
--- a/stream.c
+++ b/stream.c
@@ -158,7 +158,7 @@ static wchar_t *snarf_line(struct stdio_handle *h)
if (fill >= size) {
size_t newsize = size ? size * 2 : min_size;
- buf = chk_realloc(buf, newsize * sizeof *buf);
+ buf = (wchar_t *) chk_realloc(buf, newsize * sizeof *buf);
size = newsize;
}
@@ -170,7 +170,7 @@ static wchar_t *snarf_line(struct stdio_handle *h)
}
if (buf)
- buf = chk_realloc(buf, fill * sizeof *buf);
+ buf = (wchar_t *) chk_realloc(buf, fill * sizeof *buf);
return buf;
}
@@ -409,7 +409,7 @@ static obj_t *string_out_put_string(obj_t *stream, obj_t *str)
}
if (so->size != old_size)
- so->buf = chk_realloc(so->buf, so->size * sizeof *so->buf);
+ so->buf = (wchar_t *) chk_realloc(so->buf, so->size * sizeof *so->buf);
wmemcpy(so->buf + so->fill, s, len + 1);
so->fill += len;
return t;
@@ -546,7 +546,8 @@ obj_t *get_string_from_stream(obj_t *stream)
if (!so)
return out;
- so->buf = chk_realloc(so->buf, (so->fill + 1) * sizeof *so->buf);
+ so->buf = (wchar_t *) chk_realloc(so->buf,
+ (so->fill + 1) * sizeof *so->buf);
out = string_own(so->buf);
free(so);
return out;