mirror of
https://github.com/moparisthebest/pacman
synced 2024-12-23 00:08:50 -05:00
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>
This commit is contained in:
parent
30f338cce6
commit
62a2e45b12
@ -21,8 +21,7 @@
|
|||||||
#include <sys/types.h> /* off_t */
|
#include <sys/types.h> /* off_t */
|
||||||
|
|
||||||
#include "alpm_list.h"
|
#include "alpm_list.h"
|
||||||
#include "util.h" /* MALLOC() */
|
#include "util.h" /* CALLOC() */
|
||||||
#include "alpm.h"
|
|
||||||
|
|
||||||
struct __pmgraph_t {
|
struct __pmgraph_t {
|
||||||
char state; /* 0: untouched, -1: entered, other: leaving time */
|
char state; /* 0: untouched, -1: entered, other: leaving time */
|
||||||
@ -38,15 +37,7 @@ static pmgraph_t *_alpm_graph_new(void)
|
|||||||
{
|
{
|
||||||
pmgraph_t *graph = NULL;
|
pmgraph_t *graph = NULL;
|
||||||
|
|
||||||
MALLOC(graph, sizeof(pmgraph_t), RET_ERR(PM_ERR_MEMORY, NULL));
|
CALLOC(graph, 1, 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;
|
|
||||||
}
|
|
||||||
return(graph);
|
return(graph);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user