Skip to content

Commit

Permalink
diff-options: add --stat (take 2)
Browse files Browse the repository at this point in the history
... and a fix for an invalid free():


Signed-off-by: Junio C Hamano <junkio@cox.net>
  • Loading branch information
Johannes Schindelin authored and Junio C Hamano committed Apr 13, 2006
1 parent d75f795 commit ece634d
Showing 1 changed file with 5 additions and 5 deletions.
10 changes: 5 additions & 5 deletions diff.c
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}

/*
Expand Down Expand Up @@ -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;
Expand All @@ -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);
Expand Down

0 comments on commit ece634d

Please sign in to comment.