From af9b59e6a1a36997d7017f4841f4a934ca1ade98 Mon Sep 17 00:00:00 2001 From: Rosen Penev Date: Mon, 21 Dec 2020 23:24:11 +0100 Subject: Replace malloc + memset with calloc where appropriate calloc is faster for big allocations. It's also simpler. Signed-off-by: Rosen Penev --- src/xplist.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) (limited to 'src') diff --git a/src/xplist.c b/src/xplist.c index 3a92142..2f98983 100644 --- a/src/xplist.c +++ b/src/xplist.c @@ -211,8 +211,7 @@ static void node_to_xml(node_t* node, bytearray_t **outbuf, uint32_t depth) struct TM _btime; struct TM *btime = gmtime64_r(&timev, &_btime); if (btime) { - val = (char*)malloc(24); - memset(val, 0, 24); + val = (char*)calloc(1, 24); struct tm _tmcopy; copy_TM64_to_tm(btime, &_tmcopy); val_len = strftime(val, 24, "%Y-%m-%dT%H:%M:%SZ", &_tmcopy); -- cgit v1.1-32-gdbae