aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorArnold D. Robbins <arnold@skeeve.com>2017-02-02 15:58:13 +0200
committerArnold D. Robbins <arnold@skeeve.com>2017-02-02 15:58:13 +0200
commitca87b9c44b803aa1eb97d8f61ba7939ee618195d (patch)
treee12a79692178b3383763d104576a6721122b99e4
parenta41dd1535e2c1306247deeaca3e7a173a54ff542 (diff)
parentf0b9ec9b838045318bcc8512c48dd93c66d4eef5 (diff)
downloadegawk-ca87b9c44b803aa1eb97d8f61ba7939ee618195d.tar.gz
egawk-ca87b9c44b803aa1eb97d8f61ba7939ee618195d.tar.bz2
egawk-ca87b9c44b803aa1eb97d8f61ba7939ee618195d.zip
Merge branch 'master' into feature/fix-comments
-rw-r--r--ChangeLog5
-rw-r--r--awkgram.c6
-rw-r--r--awkgram.y6
3 files changed, 11 insertions, 6 deletions
diff --git a/ChangeLog b/ChangeLog
index 34f4897a..43681e6e 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -4,6 +4,11 @@
end for the NUL in case we add a sign. Thanks to Andrew Schorr
for making me look at this code.
+ And later in the same day:
+
+ * awkgram.y (set_profile_next): Undo previous change, since estrdup
+ handles it, but updated the comments.
+
2017-02-01 Arnold D. Robbins <arnold@skeeve.com>
* builtin.c (mbc_char_count): Remove spurious multiplies by
diff --git a/awkgram.c b/awkgram.c
index cccf7c12..6e2c7b0d 100644
--- a/awkgram.c
+++ b/awkgram.c
@@ -8737,9 +8737,9 @@ static NODE *
set_profile_text(NODE *n, const char *str, size_t len)
{
if (do_pretty_print) {
- // extra byte in case need to add minus sign in negate_num
- // and another one for the \0 at the end
- n->stptr = estrdup(str, len + 2);
+ // extra byte in case we need to add minus sign in negate_num
+ // note that estrdup adds another byte for the \0 at the end
+ n->stptr = estrdup(str, len + 1);
n->stptr[len] = '\0';
n->stlen = len;
// Set STRCUR and n->stfmt for use when profiling
diff --git a/awkgram.y b/awkgram.y
index 946299e5..bda85186 100644
--- a/awkgram.y
+++ b/awkgram.y
@@ -6309,9 +6309,9 @@ static NODE *
set_profile_text(NODE *n, const char *str, size_t len)
{
if (do_pretty_print) {
- // extra byte in case need to add minus sign in negate_num
- // and another one for the \0 at the end
- n->stptr = estrdup(str, len + 2);
+ // extra byte in case we need to add minus sign in negate_num
+ // note that estrdup adds another byte for the \0 at the end
+ n->stptr = estrdup(str, len + 1);
n->stptr[len] = '\0';
n->stlen = len;
// Set STRCUR and n->stfmt for use when profiling