diff mbox

[2/4] savevm: some coding style cleanups

Message ID 93c7221dab90d3f79bd6b6badb7228bd4dc8bc74.1317738629.git.quintela@redhat.com
State New
Headers show

Commit Message

Juan Quintela Oct. 4, 2011, 2:38 p.m. UTC
This patch will make moving code on next patches and having checkpatch
happy easier.

Signed-off-by: Juan Quintela <quintela@redhat.com>
---
 savevm.c |   21 ++++++++++++++-------
 1 files changed, 14 insertions(+), 7 deletions(-)

Comments

Anthony Liguori Oct. 5, 2011, 7:41 p.m. UTC | #1
On 10/04/2011 09:38 AM, Juan Quintela wrote:
> This patch will make moving code on next patches and having checkpatch
> happy easier.
>
> Signed-off-by: Juan Quintela<quintela@redhat.com>

Reviewed-by: Anthony Liguori <aliguori@us.ibm.com>

Regards,

Anthony Liguori

> ---
>   savevm.c |   21 ++++++++++++++-------
>   1 files changed, 14 insertions(+), 7 deletions(-)
>
> diff --git a/savevm.c b/savevm.c
> index 31131df..5fee4e2 100644
> --- a/savevm.c
> +++ b/savevm.c
> @@ -536,8 +536,9 @@ int qemu_get_buffer(QEMUFile *f, uint8_t *buf, int size1)
>   {
>       int size, l;
>
> -    if (f->is_write)
> +    if (f->is_write) {
>           abort();
> +    }
>
>       size = size1;
>       while (size>  0) {
> @@ -545,11 +546,13 @@ int qemu_get_buffer(QEMUFile *f, uint8_t *buf, int size1)
>           if (l == 0) {
>               qemu_fill_buffer(f);
>               l = f->buf_size - f->buf_index;
> -            if (l == 0)
> +            if (l == 0) {
>                   break;
> +            }
>           }
> -        if (l>  size)
> +        if (l>  size) {
>               l = size;
> +        }
>           memcpy(buf, f->buf + f->buf_index, l);
>           f->buf_index += l;
>           buf += l;
> @@ -560,26 +563,30 @@ int qemu_get_buffer(QEMUFile *f, uint8_t *buf, int size1)
>
>   static int qemu_peek_byte(QEMUFile *f)
>   {
> -    if (f->is_write)
> +    if (f->is_write) {
>           abort();
> +    }
>
>       if (f->buf_index>= f->buf_size) {
>           qemu_fill_buffer(f);
> -        if (f->buf_index>= f->buf_size)
> +        if (f->buf_index>= f->buf_size) {
>               return 0;
> +        }
>       }
>       return f->buf[f->buf_index];
>   }
>
>   int qemu_get_byte(QEMUFile *f)
>   {
> -    if (f->is_write)
> +    if (f->is_write) {
>           abort();
> +    }
>
>       if (f->buf_index>= f->buf_size) {
>           qemu_fill_buffer(f);
> -        if (f->buf_index>= f->buf_size)
> +        if (f->buf_index>= f->buf_size) {
>               return 0;
> +        }
>       }
>       return f->buf[f->buf_index++];
>   }
diff mbox

Patch

diff --git a/savevm.c b/savevm.c
index 31131df..5fee4e2 100644
--- a/savevm.c
+++ b/savevm.c
@@ -536,8 +536,9 @@  int qemu_get_buffer(QEMUFile *f, uint8_t *buf, int size1)
 {
     int size, l;

-    if (f->is_write)
+    if (f->is_write) {
         abort();
+    }

     size = size1;
     while (size > 0) {
@@ -545,11 +546,13 @@  int qemu_get_buffer(QEMUFile *f, uint8_t *buf, int size1)
         if (l == 0) {
             qemu_fill_buffer(f);
             l = f->buf_size - f->buf_index;
-            if (l == 0)
+            if (l == 0) {
                 break;
+            }
         }
-        if (l > size)
+        if (l > size) {
             l = size;
+        }
         memcpy(buf, f->buf + f->buf_index, l);
         f->buf_index += l;
         buf += l;
@@ -560,26 +563,30 @@  int qemu_get_buffer(QEMUFile *f, uint8_t *buf, int size1)

 static int qemu_peek_byte(QEMUFile *f)
 {
-    if (f->is_write)
+    if (f->is_write) {
         abort();
+    }

     if (f->buf_index >= f->buf_size) {
         qemu_fill_buffer(f);
-        if (f->buf_index >= f->buf_size)
+        if (f->buf_index >= f->buf_size) {
             return 0;
+        }
     }
     return f->buf[f->buf_index];
 }

 int qemu_get_byte(QEMUFile *f)
 {
-    if (f->is_write)
+    if (f->is_write) {
         abort();
+    }

     if (f->buf_index >= f->buf_size) {
         qemu_fill_buffer(f);
-        if (f->buf_index >= f->buf_size)
+        if (f->buf_index >= f->buf_size) {
             return 0;
+        }
     }
     return f->buf[f->buf_index++];
 }