Skip to content

Commit af0ed81

Browse files
committed
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 <[email protected]>
1 parent 99bfd40 commit af0ed81

File tree

1 file changed

+13
-13
lines changed

1 file changed

+13
-13
lines changed

diff.c

Lines changed: 13 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -1470,8 +1470,8 @@ static void show_stats(struct diffstat_t *data, struct diff_options *options)
14701470
for (i = 0; (i < count) && (i < data->nr); i++) {
14711471
struct diffstat_file *file = data->files[i];
14721472
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)) {
14751475
count++; /* not shown == room for one more */
14761476
continue;
14771477
}
@@ -1586,13 +1586,13 @@ static void show_stats(struct diffstat_t *data, struct diff_options *options)
15861586
*/
15871587
for (i = 0; i < count; i++) {
15881588
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;
15921593
int name_len;
15931594

1594-
if (!data->files[i]->is_interesting &&
1595-
(added + deleted == 0)) {
1595+
if (!file->is_interesting && (added + deleted == 0)) {
15961596
total_files--;
15971597
continue;
15981598
}
@@ -1611,7 +1611,7 @@ static void show_stats(struct diffstat_t *data, struct diff_options *options)
16111611
name = slash;
16121612
}
16131613

1614-
if (data->files[i]->is_binary) {
1614+
if (file->is_binary) {
16151615
fprintf(options->file, "%s", line_prefix);
16161616
show_name(options->file, prefix, name, len);
16171617
fprintf(options->file, " %*s", number_width, "Bin");
@@ -1628,7 +1628,7 @@ static void show_stats(struct diffstat_t *data, struct diff_options *options)
16281628
fprintf(options->file, "\n");
16291629
continue;
16301630
}
1631-
else if (data->files[i]->is_unmerged) {
1631+
else if (file->is_unmerged) {
16321632
fprintf(options->file, "%s", line_prefix);
16331633
show_name(options->file, prefix, name, len);
16341634
fprintf(options->file, " Unmerged\n");
@@ -1668,10 +1668,10 @@ static void show_stats(struct diffstat_t *data, struct diff_options *options)
16681668
fprintf(options->file, "\n");
16691669
}
16701670
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)) {
16751675
total_files--;
16761676
continue;
16771677
}

0 commit comments

Comments
 (0)