aboutsummaryrefslogtreecommitdiffstats
path: root/profile.c
diff options
context:
space:
mode:
authorArnold D. Robbins <arnold@skeeve.com>2015-04-27 14:09:25 +0300
committerArnold D. Robbins <arnold@skeeve.com>2015-04-27 14:09:25 +0300
commit7bab0e1ff31ebaf7716fe2716a630c92b8ca8a44 (patch)
treebac93ed98e429ea3ecd42885a8d087db3e69fb21 /profile.c
parenta435b8da2941d0b3c997420c71b1f4b7b79b52ff (diff)
parente78dfd4b04060ad3278a1b3505720893ec432617 (diff)
downloadegawk-7bab0e1ff31ebaf7716fe2716a630c92b8ca8a44.tar.gz
egawk-7bab0e1ff31ebaf7716fe2716a630c92b8ca8a44.tar.bz2
egawk-7bab0e1ff31ebaf7716fe2716a630c92b8ca8a44.zip
Merge branch 'master' into feature/cmake
Diffstat (limited to 'profile.c')
-rw-r--r--profile.c9
1 files changed, 4 insertions, 5 deletions
diff --git a/profile.c b/profile.c
index dc887e97..dcc2946c 100644
--- a/profile.c
+++ b/profile.c
@@ -1359,7 +1359,7 @@ pp_string(const char *in_str, size_t len, int delim)
osiz *= 2; \
} ofre -= (l)
- osiz = len + 3 + 2; /* initial size; 3 for delim + terminating null */
+ osiz = len + 3 + 1; /* initial size; 3 for delim + terminating null */
emalloc(obuf, char *, osiz, "pp_string");
obufout = obuf;
ofre = osiz - 1;
@@ -1371,10 +1371,9 @@ pp_string(const char *in_str, size_t len, int delim)
*obufout++ = '\\';
*obufout++ = delim;
} else if (*str == '\0') {
- chksize(4);
-
*obufout++ = '\\';
*obufout++ = '0';
+ chksize(2); /* need 2 more chars for this case */
*obufout++ = '0';
*obufout++ = '0';
} else if ((cp = strchr(escapes, *str)) != NULL) {
@@ -1384,7 +1383,7 @@ pp_string(const char *in_str, size_t len, int delim)
/* NB: Deliberate use of lower-case versions. */
} else if (isascii(*str) && isprint(*str)) {
*obufout++ = *str;
- ofre += 1;
+ ofre += 1; /* used 1 less than expected */
} else {
size_t len;
@@ -1607,7 +1606,7 @@ pp_group3(const char *s1, const char *s2, const char *s3)
len1 = strlen(s1);
len2 = strlen(s2);
len3 = strlen(s3);
- l = len1 + len2 + len3 + 2;
+ l = len1 + len2 + len3 + 1;
emalloc(str, char *, l, "pp_group3");
s = str;
if (len1 > 0) {