aboutsummaryrefslogtreecommitdiff
path: root/stm/main.c
diff options
context:
space:
mode:
authorPaul Sokolovsky2014-01-13 23:15:23 +0200
committerPaul Sokolovsky2014-01-13 23:31:06 +0200
commit5d2499c63813566b1e35067f6faff3046c7f9d0a (patch)
tree087fb823543cf4fd2c0bd27c6c373c3035e2e54f /stm/main.c
parentca318bba0d97c66d8fb14a089d8fa269a0e1b424 (diff)
Add "buffer management" and "shrink" API calls to vstr.
vstr is initially intended to deal with arbitrary-length strings. By providing a bit lower-level API calls, it will be also useful to deal with arbitrary-length I/O buffers (the difference from strings is that buffers are filled from "outside", via I/O). Another issue, especially aggravated by I/O buffer use, is alloc size vs actual size length. If allocated 1Mb for buffer, but actually read 1 byte, we don't want to keep rest of 1Mb be locked by this I/O result, but rather return it to heap ASAP ("shrink" buffer before passing it to qstr_from_str_take()).
Diffstat (limited to 'stm/main.c')
-rw-r--r--stm/main.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/stm/main.c b/stm/main.c
index 2085182c2..4d49b8d3d 100644
--- a/stm/main.c
+++ b/stm/main.c
@@ -390,7 +390,7 @@ void do_repl(void) {
stdout_tx_str("Type \"help()\" for more information.\r\n");
vstr_t line;
- vstr_init(&line);
+ vstr_init(&line, 32);
for (;;) {
vstr_reset(&line);