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>
This commit is contained in:
parent
99bfd40700
commit
af0ed819c5
26
diff.c
26
diff.c
@ -1470,8 +1470,8 @@ static void show_stats(struct diffstat_t *data, struct diff_options *options)
|
|||||||
for (i = 0; (i < count) && (i < data->nr); i++) {
|
for (i = 0; (i < count) && (i < data->nr); i++) {
|
||||||
struct diffstat_file *file = data->files[i];
|
struct diffstat_file *file = data->files[i];
|
||||||
uintmax_t change = file->added + file->deleted;
|
uintmax_t change = file->added + file->deleted;
|
||||||
if (!data->files[i]->is_interesting &&
|
|
||||||
(change == 0)) {
|
if (!file->is_interesting && (change == 0)) {
|
||||||
count++; /* not shown == room for one more */
|
count++; /* not shown == room for one more */
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
@ -1586,13 +1586,13 @@ static void show_stats(struct diffstat_t *data, struct diff_options *options)
|
|||||||
*/
|
*/
|
||||||
for (i = 0; i < count; i++) {
|
for (i = 0; i < count; i++) {
|
||||||
const char *prefix = "";
|
const char *prefix = "";
|
||||||
char *name = data->files[i]->print_name;
|
struct diffstat_file *file = data->files[i];
|
||||||
uintmax_t added = data->files[i]->added;
|
char *name = file->print_name;
|
||||||
uintmax_t deleted = data->files[i]->deleted;
|
uintmax_t added = file->added;
|
||||||
|
uintmax_t deleted = file->deleted;
|
||||||
int name_len;
|
int name_len;
|
||||||
|
|
||||||
if (!data->files[i]->is_interesting &&
|
if (!file->is_interesting && (added + deleted == 0)) {
|
||||||
(added + deleted == 0)) {
|
|
||||||
total_files--;
|
total_files--;
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
@ -1611,7 +1611,7 @@ static void show_stats(struct diffstat_t *data, struct diff_options *options)
|
|||||||
name = slash;
|
name = slash;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (data->files[i]->is_binary) {
|
if (file->is_binary) {
|
||||||
fprintf(options->file, "%s", line_prefix);
|
fprintf(options->file, "%s", line_prefix);
|
||||||
show_name(options->file, prefix, name, len);
|
show_name(options->file, prefix, name, len);
|
||||||
fprintf(options->file, " %*s", number_width, "Bin");
|
fprintf(options->file, " %*s", number_width, "Bin");
|
||||||
@ -1628,7 +1628,7 @@ static void show_stats(struct diffstat_t *data, struct diff_options *options)
|
|||||||
fprintf(options->file, "\n");
|
fprintf(options->file, "\n");
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
else if (data->files[i]->is_unmerged) {
|
else if (file->is_unmerged) {
|
||||||
fprintf(options->file, "%s", line_prefix);
|
fprintf(options->file, "%s", line_prefix);
|
||||||
show_name(options->file, prefix, name, len);
|
show_name(options->file, prefix, name, len);
|
||||||
fprintf(options->file, " Unmerged\n");
|
fprintf(options->file, " Unmerged\n");
|
||||||
@ -1668,10 +1668,10 @@ static void show_stats(struct diffstat_t *data, struct diff_options *options)
|
|||||||
fprintf(options->file, "\n");
|
fprintf(options->file, "\n");
|
||||||
}
|
}
|
||||||
for (i = count; i < data->nr; i++) {
|
for (i = count; i < data->nr; i++) {
|
||||||
uintmax_t added = data->files[i]->added;
|
struct diffstat_file *file = data->files[i];
|
||||||
uintmax_t deleted = data->files[i]->deleted;
|
uintmax_t added = file->added;
|
||||||
if (!data->files[i]->is_interesting &&
|
uintmax_t deleted = file->deleted;
|
||||||
(added + deleted == 0)) {
|
if (!file->is_interesting && (added + deleted == 0)) {
|
||||||
total_files--;
|
total_files--;
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user