aboutsummaryrefslogtreecommitdiff
path: root/diff.c
diff options
context:
space:
mode:
authorJohannes Schindelin <Johannes.Schindelin@gmx.de>2006-04-14 01:09:48 +0200
committerJunio C Hamano <junkio@cox.net>2006-04-13 16:50:02 -0700
commitece634d1478a9f1bf19eed8a6b7dee305fadd46e (patch)
tree690ab6756386050c951145965511b5327ff7697b /diff.c
parentd75f7952ef56408baa03ff82ded52b9289249d5a (diff)
downloadgit-ece634d1478a9f1bf19eed8a6b7dee305fadd46e.tar.gz
git-ece634d1478a9f1bf19eed8a6b7dee305fadd46e.tar.xz
diff-options: add --stat (take 2)
... and a fix for an invalid free(): Signed-off-by: Junio C Hamano <junkio@cox.net>
Diffstat (limited to 'diff.c')
-rw-r--r--diff.c10
1 files changed, 5 insertions, 5 deletions
diff --git a/diff.c b/diff.c
index 14ffc774f..c120239ef 100644
--- a/diff.c
+++ b/diff.c
@@ -266,7 +266,7 @@ static void show_stats(struct diffstat_t* data)
char *qname = xmalloc(len + 1);
quote_c_style(name, qname, NULL, 0);
free(name);
- name = qname;
+ data->files[i]->name = name = qname;
}
/*
@@ -297,10 +297,10 @@ static void show_stats(struct diffstat_t* data)
if (added < 0) {
/* binary file */
printf(" %s%-*s | Bin\n", prefix, len, name);
- continue;
+ goto free_diffstat_file;
} else if (added + deleted == 0) {
total_files--;
- continue;
+ goto free_diffstat_file;
}
add = added;
@@ -314,11 +314,11 @@ static void show_stats(struct diffstat_t* data)
add = (add * max + max_change / 2) / max_change;
del = total - add;
}
- /* TODO: binary */
printf(" %s%-*s |%5d %.*s%.*s\n", prefix,
len, name, added + deleted,
add, pluses, del, minuses);
- free(name);
+ free_diffstat_file:
+ free(data->files[i]->name);
free(data->files[i]);
}
free(data->files);