FAQ Search Today's Posts Mark Forums Read
» Video Reviews

» Linux Archive

Linux-archive is a website aiming to archive linux email lists and to make them easily accessible for linux users/developers.


» Sponsor

» Partners

» Sponsor

Go Back   Linux Archive > ArchLinux > ArchLinux Pacman Development

 
 
LinkBack Thread Tools
 
Old 02-14-2011, 09:30 PM
Pang Yan Han
 
Default 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
 
Old 02-15-2011, 09:24 PM
Dan McGee
 
Default Use CALLOC for _alpm_graph_new()

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.
 

Thread Tools




All times are GMT. The time now is 11:27 PM.

VBulletin, Copyright ©2000 - 2014, Jelsoft Enterprises Ltd.
Content Relevant URLs by vBSEO ©2007, Crawlability, Inc.
Copyright 2007 - 2008, www.linux-archive.org