diff options
author | 2019-11-28 09:51:58 +0000 | |
---|---|---|
committer | 2019-11-28 09:51:58 +0000 | |
commit | 18b1287e91faeee1e1b773686284365f28cb56d3 (patch) | |
tree | d19547ab639a6fa3d85a30753959a011a2ad176a /usr.bin/tmux/xmalloc.c | |
parent | Bump the escape sequence timeout to five seconds to allow for longer (diff) | |
download | wireguard-openbsd-18b1287e91faeee1e1b773686284365f28cb56d3.tar.xz wireguard-openbsd-18b1287e91faeee1e1b773686284365f28cb56d3.zip |
Add xrecallocarray.
Diffstat (limited to 'usr.bin/tmux/xmalloc.c')
-rw-r--r-- | usr.bin/tmux/xmalloc.c | 16 |
1 files changed, 15 insertions, 1 deletions
diff --git a/usr.bin/tmux/xmalloc.c b/usr.bin/tmux/xmalloc.c index 0871b7c7e19..7bb3b526132 100644 --- a/usr.bin/tmux/xmalloc.c +++ b/usr.bin/tmux/xmalloc.c @@ -1,4 +1,4 @@ -/* $OpenBSD: xmalloc.c,v 1.12 2019/06/28 05:44:09 deraadt Exp $ */ +/* $OpenBSD: xmalloc.c,v 1.13 2019/11/28 09:51:58 nicm Exp $ */ /* * Author: Tatu Ylonen <ylo@cs.hut.fi> @@ -71,6 +71,20 @@ xreallocarray(void *ptr, size_t nmemb, size_t size) return new_ptr; } +void * +xrecallocarray(void *ptr, size_t oldnmemb, size_t nmemb, size_t size) +{ + void *new_ptr; + + if (nmemb == 0 || size == 0) + fatalx("xrecallocarray: zero size"); + new_ptr = recallocarray(ptr, oldnmemb, nmemb, size); + if (new_ptr == NULL) + fatalx("xrecallocarray: allocating %zu * %zu bytes: %s", + nmemb, size, strerror(errno)); + return new_ptr; +} + char * xstrdup(const char *str) { |