aboutsummaryrefslogtreecommitdiffstats
path: root/helpers
diff options
context:
space:
mode:
authorArnold D. Robbins <arnold@skeeve.com>2014-12-18 21:26:14 +0200
committerArnold D. Robbins <arnold@skeeve.com>2014-12-18 21:26:14 +0200
commit06cd783a8994b704c066aa59e11a6e76292d806e (patch)
tree335a4731980ed21d3e67a872a81e065350a0b345 /helpers
parent6e786e9ea47966a9cac7cfef4a4079ac379580b0 (diff)
downloadegawk-06cd783a8994b704c066aa59e11a6e76292d806e.tar.gz
egawk-06cd783a8994b704c066aa59e11a6e76292d806e.tar.bz2
egawk-06cd783a8994b704c066aa59e11a6e76292d806e.zip
More removal of extra unused byte.
Diffstat (limited to 'helpers')
-rw-r--r--helpers/ChangeLog4
-rw-r--r--helpers/testdfa.c4
2 files changed, 6 insertions, 2 deletions
diff --git a/helpers/ChangeLog b/helpers/ChangeLog
index a5bbafb1..2cb3be44 100644
--- a/helpers/ChangeLog
+++ b/helpers/ChangeLog
@@ -1,3 +1,7 @@
+2014-12-18 Arnold D. Robbins <arnold@skeeve.com>
+
+ * testdfa.c (setup_pattern): Do not waste a byte at the end of a string.
+
2014-09-04 Arnold D. Robbins <arnold@skeeve.com>
* chlistref.awk: New file. Finds @ref{} to non-chapters.
diff --git a/helpers/testdfa.c b/helpers/testdfa.c
index 25a229a2..092a13d8 100644
--- a/helpers/testdfa.c
+++ b/helpers/testdfa.c
@@ -392,14 +392,14 @@ setup_pattern(const char *pattern, size_t *len)
* from that.
*/
if (buf == NULL) {
- buf = (char *) malloc(*len + 2);
+ buf = (char *) malloc(*len + 1);
if (buf == NULL) {
fprintf(stderr, "%s: malloc failed\n", __func__);
exit(EXIT_FAILURE);
}
buflen = *len;
} else if (*len > buflen) {
- buf = (char *) realloc(buf, *len + 2);
+ buf = (char *) realloc(buf, *len + 1);
if (buf == NULL) {
fprintf(stderr, "%s: realloc failed\n", __func__);
exit(EXIT_FAILURE);