diff options
author | Kaz Kylheku <kaz@kylheku.com> | 2020-02-06 21:19:50 -0800 |
---|---|---|
committer | Kaz Kylheku <kaz@kylheku.com> | 2020-02-06 21:19:50 -0800 |
commit | 52c1aef14849e0f3f4ecb4f6177c48af3b352631 (patch) | |
tree | 1bca87f87a14d49531adeec27749c99a81a04172 /txr.1 | |
parent | a7881343e163ba29c31f946e9f943685bb977d6d (diff) | |
download | txr-52c1aef14849e0f3f4ecb4f6177c48af3b352631.tar.gz txr-52c1aef14849e0f3f4ecb4f6177c48af3b352631.tar.bz2 txr-52c1aef14849e0f3f4ecb4f6177c48af3b352631.zip |
buf: bugfix: buf-set-length not setting bytes.
* buf.c (buf_grow): Function removed; logic merged into
buf_do_set_len. The bug fixed is that buf_grow was
initializing just the newly allocated bytes to init_val. The
bytes that must actually be initialized are those which lie
between the old and new length, not in the allocated area.
(make_buf): In make_buf, we don't have to initialize the
entire buffer, but only bytes 0 through len - 1. Now
calloc is only used when the initializing value is zero,
and the buffer's allocation size is the same as the length.
When the length is increase to protrude into the allocated
uninitialized area, buf_do_set_len will now properly
initialize that to the value given at that time.
* txr.1: Update make-buf documentation not to say that
all the bytes of the buffer are initialized.
Diffstat (limited to 'txr.1')
-rw-r--r-- | txr.1 | 5 |
1 files changed, 3 insertions, 2 deletions
@@ -24065,8 +24065,9 @@ bytes. This argument may be zero. If .meta init-val -is present, it specifies the value with which every -byte of the buffer is initialized. If omitted, it +is present, it specifies the value with which the first +.meta len +byte of the buffer are initialized. If omitted, it defaults to zero. bytes. The value of .meta init-val |