From eb5a1f61c46ed5a442a22ba847955730dd52f624 Mon Sep 17 00:00:00 2001 From: Ulrich Drepper Date: Fri, 30 Oct 1998 18:55:10 +0000 Subject: [PATCH] Do a better job in initializing dynamic memory. --- catgets/gencat.c | 13 ++++--------- 1 file changed, 4 insertions(+), 9 deletions(-) diff --git a/catgets/gencat.c b/catgets/gencat.c index 20a3e6ac55..e1396a12cd 100644 --- a/catgets/gencat.c +++ b/catgets/gencat.c @@ -264,16 +264,13 @@ read_input_file (struct catalog *current, const char *fname) /* If we haven't seen anything yet, allocate result structure. */ if (current == NULL) { - current = (struct catalog *) xmalloc (sizeof (*current)); - - current->all_sets = NULL; - current->total_messages = 0; - current->last_set = 0; - current->current_set = find_set (current, NL_SETD); + current = (struct catalog *) xcalloc (1, sizeof (*current)); #define obstack_chunk_alloc malloc #define obstack_chunk_free free obstack_init (¤t->mem_pool); + + current->current_set = find_set (current, NL_SETD); } buf = NULL; @@ -866,10 +863,8 @@ find_set (struct catalog *current, int number) result = result->next; /* Prepare new message set. */ - result = (struct set_list *) xmalloc (sizeof (*result)); + result = (struct set_list *) xcalloc (1, sizeof (*result)); result->number = number; - result->deleted = 0; - result->messages = NULL; result->next = current->all_sets; current->all_sets = result;