Don't xcalloc() struct diffstat_t

Signed-off-by: Timo Hirvonen <tihirvon@gmail.com>
Signed-off-by: Junio C Hamano <junkio@cox.net>
This commit is contained in:
Timo Hirvonen 2006-06-25 14:28:19 +03:00 committed by Junio C Hamano
parent 39bc9a6c20
commit 5e2b0636c7

11
diff.c
View File

@ -2115,17 +2115,16 @@ void diff_flush(struct diff_options *options)
} }
if (output_format & DIFF_FORMAT_DIFFSTAT) { if (output_format & DIFF_FORMAT_DIFFSTAT) {
struct diffstat_t *diffstat; struct diffstat_t diffstat;
diffstat = xcalloc(sizeof (struct diffstat_t), 1); memset(&diffstat, 0, sizeof(struct diffstat_t));
diffstat->xm.consume = diffstat_consume; diffstat.xm.consume = diffstat_consume;
for (i = 0; i < q->nr; i++) { for (i = 0; i < q->nr; i++) {
struct diff_filepair *p = q->queue[i]; struct diff_filepair *p = q->queue[i];
if (check_pair_status(p)) if (check_pair_status(p))
diff_flush_stat(p, options, diffstat); diff_flush_stat(p, options, &diffstat);
} }
show_stats(diffstat); show_stats(&diffstat);
free(diffstat);
} }
if (output_format & DIFF_FORMAT_SUMMARY) { if (output_format & DIFF_FORMAT_SUMMARY) {