[pacman-dev] [PATCH] 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> --- 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
On Mon, Feb 14, 2011 at 4:30 PM, Pang Yan Han <pangyanhan@gmail.com> wrote:
Change _alpm_graph_new() to use CALLOC to avoid explicit zeroing out of fields in pmgraph_t.
Thanks.
participants (2)
-
Dan McGee
-
Pang Yan Han