diff options
author | Arnold D. Robbins <arnold@skeeve.com> | 2014-12-14 20:38:14 +0200 |
---|---|---|
committer | Arnold D. Robbins <arnold@skeeve.com> | 2014-12-14 20:38:14 +0200 |
commit | c55956b6a10d0a4d0b151c1be976dc9c344c1103 (patch) | |
tree | 8711c2b5a501af116782f470fa5c0ec9e18dbabf /io.c | |
parent | b6ac928a53d146233741fc5f7fe1cac66de27303 (diff) | |
download | egawk-c55956b6a10d0a4d0b151c1be976dc9c344c1103.tar.gz egawk-c55956b6a10d0a4d0b151c1be976dc9c344c1103.tar.bz2 egawk-c55956b6a10d0a4d0b151c1be976dc9c344c1103.zip |
More fixes to stop allocating an extra byte.
Diffstat (limited to 'io.c')
-rw-r--r-- | io.c | 10 |
1 files changed, 5 insertions, 5 deletions
@@ -2554,7 +2554,7 @@ init_awkpath(path_info *pi) end++; len = end - start; if (len > 0) { - emalloc(p, char *, len + 2, "init_awkpath"); + emalloc(p, char *, len + 1, "init_awkpath"); memcpy(p, start, len); /* add directory punctuation if necessary */ @@ -3040,10 +3040,10 @@ grow_iop_buffer(IOBUF *iop) size_t newsize; /* - * Lop off original extra two bytes, double the size, - * add them back. + * Lop off original extra byte, double the size, + * add it back. */ - newsize = ((iop->size - 2) * 2) + 2; + newsize = ((iop->size - 1) * 2) + 1; /* Check for overflow */ if (newsize <= iop->size) @@ -3051,7 +3051,7 @@ grow_iop_buffer(IOBUF *iop) /* Make sure there's room for a disk block */ if (newsize - valid < iop->readsize) - newsize += iop->readsize + 2; + newsize += iop->readsize + 1; /* Check for overflow, again */ if (newsize <= iop->size) |