diff options
author | Pang Yan Han <pangyanhan@gmail.com> | 2011-02-14 23:30:49 +0100 |
---|---|---|
committer | Dan McGee <dan@archlinux.org> | 2011-02-15 23:23:36 +0100 |
commit | 62a2e45b12f746c098523782fb5889793ef59687 (patch) | |
tree | 1361eb3f1238d90a2d7aebbc670671a20b364e9d /lib | |
parent | 30f338cce6ebcab5dc521f5effef4c6527e8a197 (diff) | |
download | pacman-62a2e45b12f746c098523782fb5889793ef59687.tar.gz pacman-62a2e45b12f746c098523782fb5889793ef59687.tar.xz |
Use CALLOC for _alpm_graph_new()
Change _alpm_graph_new() to use CALLOC to avoid explicit zeroing out of fields
in pmgraph_t.
Signed-off-by: Pang Yan Han <pangyanhan@gmail.com>
Signed-off-by: Dan McGee <dan@archlinux.org>
Diffstat (limited to 'lib')
-rw-r--r-- | lib/libalpm/graph.h | 13 |
1 files changed, 2 insertions, 11 deletions
diff --git a/lib/libalpm/graph.h b/lib/libalpm/graph.h index 69f65000..07986f66 100644 --- a/lib/libalpm/graph.h +++ b/lib/libalpm/graph.h @@ -21,8 +21,7 @@ #include <sys/types.h> /* off_t */ #include "alpm_list.h" -#include "util.h" /* MALLOC() */ -#include "alpm.h" +#include "util.h" /* CALLOC() */ struct __pmgraph_t { char state; /* 0: untouched, -1: entered, other: leaving time */ @@ -38,15 +37,7 @@ static pmgraph_t *_alpm_graph_new(void) { pmgraph_t *graph = NULL; - MALLOC(graph, sizeof(pmgraph_t), RET_ERR(PM_ERR_MEMORY, NULL)); - - if(graph) { - graph->state = 0; - graph->data = NULL; - graph->parent = NULL; - graph->children = NULL; - graph->childptr = NULL; - } + CALLOC(graph, 1, sizeof(pmgraph_t), RET_ERR(PM_ERR_MEMORY, NULL)); return(graph); } |