Don't xcalloc() struct diffstat_t
authorTimo Hirvonen <tihirvon@gmail.com>
Sun, 25 Jun 2006 11:28:19 +0000 (14:28 +0300)
committerJunio C Hamano <junkio@cox.net>
Mon, 26 Jun 2006 21:58:41 +0000 (14:58 -0700)
Signed-off-by: Timo Hirvonen <tihirvon@gmail.com>
Signed-off-by: Junio C Hamano <junkio@cox.net>
diff.c

diff --git a/diff.c b/diff.c
index 491b846f6238e5915313e955ca4822fccc72707f..54698f511ae402d1051f059d926dc8682e097ba0 100644 (file)
--- a/diff.c
+++ b/diff.c
@@ -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) {