On Freitag, 8. September 2017 14:05:07 CEST Jiri Olsa wrote:
> Unlikely, but we could have ui_progress__init being called
> with total < 16, which would set the next and step variables
> to 0. That would force unnecessary ui_progress__ops->update
> calls because 'next' would never raise.
> 
> Forcing the next and step values to be always > 0.
> 
> Link: http://lkml.kernel.org/n/[email protected]
> Signed-off-by: Jiri Olsa <[email protected]>
> ---
>  tools/perf/ui/progress.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/tools/perf/ui/progress.c b/tools/perf/ui/progress.c
> index a0f24c7115c5..a9c15804b1f6 100644
> --- a/tools/perf/ui/progress.c
> +++ b/tools/perf/ui/progress.c
> @@ -25,7 +25,7 @@ void ui_progress__update(struct ui_progress *p, u64 adv)
>  void ui_progress__init(struct ui_progress *p, u64 total, const char *title)
> {
>       p->curr = 0;
> -     p->next = p->step = total / 16;
> +     p->next = p->step = total / 16 ?: 1;
>       p->total = total;
>       p->title = title;

This is a GNU extension, does this compile with clang?

Cheers

-- 
Milian Wolff | [email protected] | Senior Software Engineer
KDAB (Deutschland) GmbH&Co KG, a KDAB Group company
Tel: +49-30-521325470
KDAB - The Qt Experts


Reply via email to