Skip to content

Commit

Permalink
Don't xcalloc() struct diffstat_t
Browse files Browse the repository at this point in the history
Signed-off-by: Timo Hirvonen <[email protected]>
Signed-off-by: Junio C Hamano <[email protected]>
  • Loading branch information
tihirvon authored and Junio C Hamano committed Jun 26, 2006
1 parent 39bc9a6 commit 5e2b063
Showing 1 changed file with 5 additions and 6 deletions.
11 changes: 5 additions & 6 deletions diff.c
Original file line number Diff line number Diff line change
Expand Up @@ -2115,17 +2115,16 @@ void diff_flush(struct diff_options *options)
}

if (output_format & DIFF_FORMAT_DIFFSTAT) {
struct diffstat_t *diffstat;
struct diffstat_t diffstat;

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

if (output_format & DIFF_FORMAT_SUMMARY) {
Expand Down

0 comments on commit 5e2b063

Please sign in to comment.