diff options
author | Thomas Adam <thomas@xteddy.org> | 2014-10-21 07:11:44 +0100 |
---|---|---|
committer | Thomas Adam <thomas@xteddy.org> | 2014-10-21 07:11:44 +0100 |
commit | 562af864bd8ab06c416075b5742ce3bbcf6d0610 (patch) | |
tree | 2c3900dd6b284aa52441c3fde9dfdf8383d87b54 /format.c | |
parent | b6aef2490f086f3404f439308bb1746ec5134e9a (diff) | |
parent | 0a1a88d63caf3a0e8b4440686e73e1f0f690e03c (diff) | |
download | rtmux-562af864bd8ab06c416075b5742ce3bbcf6d0610.tar.gz rtmux-562af864bd8ab06c416075b5742ce3bbcf6d0610.tar.bz2 rtmux-562af864bd8ab06c416075b5742ce3bbcf6d0610.zip |
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.c | 9 |
1 files changed, 5 insertions, 4 deletions
@@ -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++] = '#'; |