summaryrefslogtreecommitdiffstats
path: root/stream.c
diff options
context:
space:
mode:
Diffstat (limited to 'stream.c')
-rw-r--r--stream.c27
1 files changed, 27 insertions, 0 deletions
diff --git a/stream.c b/stream.c
index ec9a7f66..4cad323d 100644
--- a/stream.c
+++ b/stream.c
@@ -4605,6 +4605,33 @@ val make_byte_input_stream(val obj)
}
}
+static val iobuf_free_list;
+
+val iobuf_get(void)
+{
+ val buf = iobuf_free_list;
+
+ if (buf) {
+ val next = buf->b.len;
+ buf->b.len = buf->b.size;
+ iobuf_free_list = next;
+ return buf;
+ } else {
+ return make_buf(num_fast(BUFSIZ), nil, nil);
+ }
+}
+
+void iobuf_put(val buf)
+{
+ buf->b.len = iobuf_free_list;
+ iobuf_free_list = buf;
+}
+
+void iobuf_list_empty(void)
+{
+ iobuf_free_list = nil;
+}
+
void stream_init(void)
{
prot1(&ap_regex);