summaryrefslogtreecommitdiffstats
path: root/format.c
diff options
context:
space:
mode:
authorThomas Adam <thomas@xteddy.org>2014-10-21 07:11:44 +0100
committerThomas Adam <thomas@xteddy.org>2014-10-21 07:11:44 +0100
commit562af864bd8ab06c416075b5742ce3bbcf6d0610 (patch)
tree2c3900dd6b284aa52441c3fde9dfdf8383d87b54 /format.c
parentb6aef2490f086f3404f439308bb1746ec5134e9a (diff)
parent0a1a88d63caf3a0e8b4440686e73e1f0f690e03c (diff)
Merge branch 'obsd-master'
Conflicts: Makefile cmd-list-commands.c cmd-suspend-client.c job.c tmux.h xmalloc.c
Diffstat (limited to 'format.c')
-rw-r--r--format.c9
1 files changed, 5 insertions, 4 deletions
diff --git a/format.c b/format.c
index baf23ec1..105212a3 100644
--- a/format.c
+++ b/format.c
@@ -17,6 +17,7 @@
*/
#include <sys/types.h>
+#include <sys/param.h>
#include <ctype.h>
#include <errno.h>
@@ -267,7 +268,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 +299,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 +327,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 +340,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++] = '#';