use libc calloc() and show 'calloc:' on error - sacc - sacc(omys), simple console gopher client
(HTM) git clone git://bitreich.org/sacc/ git://enlrupgkhuxnvlhsf6lc3fziv5h2hhfrinws65d7roiv6bfj7d652fid.onion/sacc/
(DIR) Log
(DIR) Files
(DIR) Refs
(DIR) Tags
(DIR) LICENSE
---
(DIR) commit e1eceee39ab489e5bc8ead2f8244b0cad3d1618f
(DIR) parent 687f65e4cda6fdfe5eafd263bb30a091fe3443af
(HTM) Author: Hiltjo Posthuma <hiltjo@codemadness.org>
Date: Sun, 25 Feb 2018 15:53:29 +0100
use libc calloc() and show 'calloc:' on error
Diffstat:
M sacc.c | 6 +++---
1 file changed, 3 insertions(+), 3 deletions(-)
---
(DIR) diff --git a/sacc.c b/sacc.c
@@ -121,10 +121,10 @@ xmalloc(const size_t n)
static void *
xcalloc(size_t n)
{
- char *m = xmalloc(n);
+ char *m = calloc(1, n);
- while (n)
- m[--n] = 0;
+ if (!m)
+ die("calloc: %s", strerror(errno));
return m;
}