[pacman-dev] [PATCH] Use CALLOC for _alpm_graph_new()
Pang Yan Han
pangyanhan at gmail.com
Mon Feb 14 17:30:49 EST 2011
Change _alpm_graph_new() to use CALLOC to avoid explicit zeroing out of fields
in pmgraph_t.
Signed-off-by: Pang Yan Han <pangyanhan at gmail.com>
---
lib/libalpm/graph.h | 10 +---------
1 files changed, 1 insertions(+), 9 deletions(-)
diff --git a/lib/libalpm/graph.h b/lib/libalpm/graph.h
index 69f6500..f16d048 100644
--- a/lib/libalpm/graph.h
+++ b/lib/libalpm/graph.h
@@ -38,15 +38,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);
}
--
1.7.4
More information about the pacman-dev
mailing list