summaryrefslogtreecommitdiffstats
path: root/thumbs.c
diff options
context:
space:
mode:
authorNRK <nrk@disroot.org>2022-02-03 09:22:25 +0100
committerN-R-K <79544946+N-R-K@users.noreply.github.com>2022-02-17 07:16:19 +0100
commit48343e99b8bb27fdc7763e521ea7e651ecc7a7ba (patch)
treec541b394ebb9d03d8b51919eb6cadef917a819b3 /thumbs.c
parent9cdeeab9b813a44ac6f23c0494626fa0f0727f42 (diff)
downloadnsxiv-48343e99b8bb27fdc7763e521ea7e651ecc7a7ba.tar.zst
code-style: prefer calloc over malloc+memset
Diffstat (limited to 'thumbs.c')
-rw-r--r--thumbs.c8
1 files changed, 3 insertions, 5 deletions
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;