diff mbox

[v4,17/26] progress: Allow regressing progress

Message ID 1417613866-25890-18-git-send-email-mreitz@redhat.com
State New
Headers show

Commit Message

Max Reitz Dec. 3, 2014, 1:37 p.m. UTC
Progress may regress; this should be displayed correctly by
qemu_progress_print().

While touching that area of code, drop the redundant parentheses in the
same condition.

Signed-off-by: Max Reitz <mreitz@redhat.com>
---
 util/qemu-progress.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

Comments

Eric Blake Dec. 3, 2014, 11:03 p.m. UTC | #1
On 12/03/2014 05:37 AM, Max Reitz wrote:
> Progress may regress; this should be displayed correctly by
> qemu_progress_print().
> 
> While touching that area of code, drop the redundant parentheses in the
> same condition.
> 
> Signed-off-by: Max Reitz <mreitz@redhat.com>
> ---
>  util/qemu-progress.c | 3 ++-
>  1 file changed, 2 insertions(+), 1 deletion(-)

Reviewed-by: Eric Blake <eblake@redhat.com>

> 
> diff --git a/util/qemu-progress.c b/util/qemu-progress.c
> index 4ee5cd0..532333e 100644
> --- a/util/qemu-progress.c
> +++ b/util/qemu-progress.c
> @@ -152,7 +152,8 @@ void qemu_progress_print(float delta, int max)
>      state.current = current;
>  
>      if (current > (state.last_print + state.min_skip) ||
> -        (current == 100) || (current == 0)) {
> +        current < (state.last_print - state.min_skip) ||
> +        current == 100 || current == 0) {
>          state.last_print = state.current;
>          state.print();
>      }
>
Stefan Hajnoczi Dec. 11, 2014, 2:41 p.m. UTC | #2
On Wed, Dec 03, 2014 at 02:37:37PM +0100, Max Reitz wrote:
> Progress may regress; this should be displayed correctly by
> qemu_progress_print().
> 
> While touching that area of code, drop the redundant parentheses in the
> same condition.
> 
> Signed-off-by: Max Reitz <mreitz@redhat.com>
> ---
>  util/qemu-progress.c | 3 ++-
>  1 file changed, 2 insertions(+), 1 deletion(-)

Reviewed-by: Stefan Hajnoczi <stefanha@redhat.com>
diff mbox

Patch

diff --git a/util/qemu-progress.c b/util/qemu-progress.c
index 4ee5cd0..532333e 100644
--- a/util/qemu-progress.c
+++ b/util/qemu-progress.c
@@ -152,7 +152,8 @@  void qemu_progress_print(float delta, int max)
     state.current = current;
 
     if (current > (state.last_print + state.min_skip) ||
-        (current == 100) || (current == 0)) {
+        current < (state.last_print - state.min_skip) ||
+        current == 100 || current == 0) {
         state.last_print = state.current;
         state.print();
     }