diff options
author | nicm <nicm> | 2014-10-08 17:35:58 +0000 |
---|---|---|
committer | nicm <nicm> | 2014-10-08 17:35:58 +0000 |
commit | a27ba6e38006c12c48de88600b8cff9f6aabfed7 (patch) | |
tree | fc8ecf1c1b965f70b95d0a3e472cd0b1a2e1d2c9 /format.c | |
parent | 77efcf8bdd14cd19dc445cf6e44bba7af414939c (diff) |
Add xreallocarray and remove nmemb argument from xrealloc.
Diffstat (limited to 'format.c')
-rw-r--r-- | format.c | 8 |
1 files changed, 4 insertions, 4 deletions
@@ -267,7 +267,7 @@ format_replace(struct format_tree *ft, const char *key, size_t keylen, /* Expand the buffer and copy in the value. */ while (*len - *off < valuelen + 1) { - *buf = xrealloc(*buf, 2, *len); + *buf = xreallocarray(*buf, 2, *len); *len *= 2; } memcpy(*buf + *off, value, valuelen); @@ -298,7 +298,7 @@ format_expand(struct format_tree *ft, const char *fmt) while (*fmt != '\0') { if (*fmt != '#') { while (len - off < 2) { - buf = xrealloc(buf, 2, len); + buf = xreallocarray(buf, 2, len); len *= 2; } buf[off++] = *fmt++; @@ -326,7 +326,7 @@ format_expand(struct format_tree *ft, const char *fmt) continue; case '#': while (len - off < 2) { - buf = xrealloc(buf, 2, len); + buf = xreallocarray(buf, 2, len); len *= 2; } buf[off++] = '#'; @@ -339,7 +339,7 @@ format_expand(struct format_tree *ft, const char *fmt) s = format_lower[ch - 'a']; if (s == NULL) { while (len - off < 3) { - buf = xrealloc(buf, 2, len); + buf = xreallocarray(buf, 2, len); len *= 2; } buf[off++] = '#'; |