зеркало из https://github.com/microsoft/git.git
progress.c: use dereferenced "progress" variable, not "(*p_progress)"
Since98a1364740
(trace2: log progress time and throughput, 2020-05-12) stop_progress() dereferences a "struct progress **" parameter in several places. Extract a dereferenced variable to reduce clutter and make it clearer who needs to write to this parameter. Now instead of using "*p_progress" several times in stop_progress() we check it once for NULL and then use a dereferenced "progress" variable thereafter. This uses the same pattern as the adjacent stop_progress_msg() function, seeac900fddb7
(progress: don't dereference before checking for NULL, 2020-08-10). Signed-off-by: Ævar Arnfjörð Bjarmason <avarab@gmail.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
This commit is contained in:
Родитель
a02014bb4c
Коммит
1ccad6a1f1
15
progress.c
15
progress.c
|
@ -319,21 +319,24 @@ static void finish_if_sparse(struct progress *progress)
|
||||||
|
|
||||||
void stop_progress(struct progress **p_progress)
|
void stop_progress(struct progress **p_progress)
|
||||||
{
|
{
|
||||||
|
struct progress *progress;
|
||||||
|
|
||||||
if (!p_progress)
|
if (!p_progress)
|
||||||
BUG("don't provide NULL to stop_progress");
|
BUG("don't provide NULL to stop_progress");
|
||||||
|
progress = *p_progress;
|
||||||
|
|
||||||
finish_if_sparse(*p_progress);
|
finish_if_sparse(progress);
|
||||||
|
|
||||||
if (*p_progress) {
|
if (progress) {
|
||||||
trace2_data_intmax("progress", the_repository, "total_objects",
|
trace2_data_intmax("progress", the_repository, "total_objects",
|
||||||
(*p_progress)->total);
|
progress->total);
|
||||||
|
|
||||||
if ((*p_progress)->throughput)
|
if (progress->throughput)
|
||||||
trace2_data_intmax("progress", the_repository,
|
trace2_data_intmax("progress", the_repository,
|
||||||
"total_bytes",
|
"total_bytes",
|
||||||
(*p_progress)->throughput->curr_total);
|
progress->throughput->curr_total);
|
||||||
|
|
||||||
trace2_region_leave("progress", (*p_progress)->title, the_repository);
|
trace2_region_leave("progress", progress->title, the_repository);
|
||||||
}
|
}
|
||||||
|
|
||||||
stop_progress_msg(p_progress, _("done"));
|
stop_progress_msg(p_progress, _("done"));
|
||||||
|
|
Загрузка…
Ссылка в новой задаче