summaryrefslogtreecommitdiffstats
path: root/libcnary/node_list.c
diff options
context:
space:
mode:
authorGravatar Rosen Penev2020-12-21 23:24:11 +0100
committerGravatar Nikias Bassen2021-01-25 16:20:57 +0100
commitaf9b59e6a1a36997d7017f4841f4a934ca1ade98 (patch)
treef5eb124cbbfbd49b0f6195257752b62176a520ed /libcnary/node_list.c
parent7b1ccb403ad284b896a4e710fab578e397f101c0 (diff)
downloadlibplist-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 'libcnary/node_list.c')
-rw-r--r--libcnary/node_list.c5
1 files changed, 2 insertions, 3 deletions
diff --git a/libcnary/node_list.c b/libcnary/node_list.c
index d071881..aee3bd6 100644
--- a/libcnary/node_list.c
+++ b/libcnary/node_list.c
@@ -33,11 +33,10 @@ void node_list_destroy(node_list_t* list) {
}
node_list_t* node_list_create() {
- node_list_t* list = (node_list_t*) malloc(sizeof(node_list_t));
- if(list == NULL) {
+ node_list_t* list = (node_list_t*)calloc(1, sizeof(node_list_t));
+ if (list == NULL) {
return NULL;
}
- memset(list, '\0', sizeof(node_list_t));
// Initialize structure
list->begin = NULL;