From 48343e99b8bb27fdc7763e521ea7e651ecc7a7ba Mon Sep 17 00:00:00 2001 From: NRK Date: Thu, 3 Feb 2022 14:22:25 +0600 Subject: code-style: prefer calloc over malloc+memset --- thumbs.c | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-) (limited to 'thumbs.c') diff --git a/thumbs.c b/thumbs.c index b743e53..4c02e6a 100644 --- a/thumbs.c +++ b/thumbs.c @@ -149,12 +149,10 @@ void tns_init(tns_t *tns, fileinfo_t *files, const int *cnt, int *sel, win_t *wi int len; const char *homedir, *dsuffix = ""; - if (cnt != NULL && *cnt > 0) { - tns->thumbs = emalloc(*cnt * sizeof(thumb_t)); - memset(tns->thumbs, 0, *cnt * sizeof(thumb_t)); - } else { + if (cnt != NULL && *cnt > 0) + tns->thumbs = ecalloc(*cnt, sizeof(thumb_t)); + else tns->thumbs = NULL; - } tns->files = files; tns->cnt = cnt; tns->initnext = tns->loadnext = 0; -- cgit v1.2.3-54-g00ecf