diff options
author | Rosen Penev | 2020-12-21 23:24:11 +0100 |
---|---|---|
committer | Nikias Bassen | 2021-01-25 16:20:57 +0100 |
commit | af9b59e6a1a36997d7017f4841f4a934ca1ade98 (patch) | |
tree | f5eb124cbbfbd49b0f6195257752b62176a520ed /src | |
parent | 7b1ccb403ad284b896a4e710fab578e397f101c0 (diff) | |
download | libplist-af9b59e6a1a36997d7017f4841f4a934ca1ade98.tar.gz libplist-af9b59e6a1a36997d7017f4841f4a934ca1ade98.tar.bz2 |
Replace malloc + memset with calloc where appropriate
calloc is faster for big allocations. It's also simpler.
Signed-off-by: Rosen Penev <rosenp@gmail.com>
Diffstat (limited to 'src')
-rw-r--r-- | src/xplist.c | 3 |
1 files changed, 1 insertions, 2 deletions
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); |