diff --stat: use "file" temporary variable to refer to data->files[i]

The generated code shouldn't change but it is easier to read. Signed-off-by: Junio C Hamano <gitster@pobox.com>

Junio C Hamano committed Nov 27, 2012 at 11:24 UTC af0ed819c59248bc98f0a572bd4cdcb394f185c7
1 file changed +13 -13
diff.c
+13 -13
@@ -1470,8 +1470,8 @@ static void show_stats(struct diffstat_t *data, struct diff_options *options)
1470 for (i = 0; (i < count) && (i < data->nr); i++) {
1471 struct diffstat_file *file = data->files[i];
1472 uintmax_t change = file->added + file->deleted;
1473 - if (!data->files[i]->is_interesting &&
1474 - (change == 0)) {
1473 +
1474 + if (!file->is_interesting && (change == 0)) {
1475 count++; /* not shown == room for one more */
1476 continue;
1477 }
@@ -1586,13 +1586,13 @@ static void show_stats(struct diffstat_t *data, struct diff_options *options)
1586 */
1587 for (i = 0; i < count; i++) {
1588 const char *prefix = "";
1589 - char *name = data->files[i]->print_name;
1590 - uintmax_t added = data->files[i]->added;
1591 - uintmax_t deleted = data->files[i]->deleted;
1589 + struct diffstat_file *file = data->files[i];
1590 + char *name = file->print_name;
1591 + uintmax_t added = file->added;
1592 + uintmax_t deleted = file->deleted;
1593 int name_len;
1594
1594 - if (!data->files[i]->is_interesting &&
1595 - (added + deleted == 0)) {
1595 + if (!file->is_interesting && (added + deleted == 0)) {
1596 total_files--;
1597 continue;
1598 }
@@ -1611,7 +1611,7 @@ static void show_stats(struct diffstat_t *data, struct diff_options *options)
1611 name = slash;
1612 }
1613
1614 - if (data->files[i]->is_binary) {
1614 + if (file->is_binary) {
1615 fprintf(options->file, "%s", line_prefix);
1616 show_name(options->file, prefix, name, len);
1617 fprintf(options->file, " %*s", number_width, "Bin");
@@ -1628,7 +1628,7 @@ static void show_stats(struct diffstat_t *data, struct diff_options *options)
1628 fprintf(options->file, "\n");
1629 continue;
1630 }
1631 - else if (data->files[i]->is_unmerged) {
1631 + else if (file->is_unmerged) {
1632 fprintf(options->file, "%s", line_prefix);
1633 show_name(options->file, prefix, name, len);
1634 fprintf(options->file, " Unmerged\n");
@@ -1668,10 +1668,10 @@ static void show_stats(struct diffstat_t *data, struct diff_options *options)
1668 fprintf(options->file, "\n");
1669 }
1670 for (i = count; i < data->nr; i++) {
1671 - uintmax_t added = data->files[i]->added;
1672 - uintmax_t deleted = data->files[i]->deleted;
1673 - if (!data->files[i]->is_interesting &&
1674 - (added + deleted == 0)) {
1671 + struct diffstat_file *file = data->files[i];
1672 + uintmax_t added = file->added;
1673 + uintmax_t deleted = file->deleted;
1674 + if (!file->is_interesting && (added + deleted == 0)) {
1675 total_files--;
1676 continue;
1677 }