[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Xen-changelog] [xen master] libxc: tidy up loop construct in write_compressed



commit fcaacad1a472f3023a7fd9cea4132c3f6533c913
Author:     Matthew Daley <mattjd@xxxxxxxxx>
AuthorDate: Wed Oct 30 20:51:41 2013 +1300
Commit:     Ian Campbell <ian.campbell@xxxxxxxxxx>
CommitDate: Thu Oct 31 21:23:49 2013 +0000

    libxc: tidy up loop construct in write_compressed
    
    ...otherwise the return 0 at the bottom is dead code.
    
    Coverity-ID: 1055189
    Signed-off-by: Matthew Daley <mattjd@xxxxxxxxx>
    Reviewed-by: Andrew Cooper <andrew.cooper3@xxxxxxxxxx>
    Acked-by: Ian Campbell <ian.campbell@xxxxxxxxxx>
---
 tools/libxc/xc_domain_save.c |    6 +++---
 1 files changed, 3 insertions(+), 3 deletions(-)

diff --git a/tools/libxc/xc_domain_save.c b/tools/libxc/xc_domain_save.c
index 673d1e9..42c4752 100644
--- a/tools/libxc/xc_domain_save.c
+++ b/tools/libxc/xc_domain_save.c
@@ -233,7 +233,7 @@ static int write_compressed(xc_interface *xch, comp_ctx 
*compress_ctx,
     int marker = XC_SAVE_ID_COMPRESSED_DATA;
     unsigned long compbuf_len = 0;
 
-    do
+    for(;;)
     {
         /* check for available space (atleast 8k) */
         if ((ob->pos + header + XC_PAGE_SIZE * 2) > ob->size)
@@ -250,7 +250,7 @@ static int write_compressed(xc_interface *xch, comp_ctx 
*compress_ctx,
                                            ob->size - ob->pos - header,
                                            &compbuf_len);
         if (!rc)
-            return 0;
+            break;
 
         if (outbuf_hardwrite(xch, ob, fd, &marker, sizeof(marker)) < 0)
         {
@@ -270,7 +270,7 @@ static int write_compressed(xc_interface *xch, comp_ctx 
*compress_ctx,
             ERROR("Error when writing compressed chunk");
             return -1;
         }
-    } while (rc != 0);
+    }
 
     return 0;
 }
--
generated by git-patchbot for /home/xen/git/xen.git#master

_______________________________________________
Xen-changelog mailing list
Xen-changelog@xxxxxxxxxxxxx
http://lists.xensource.com/xen-changelog


 


Rackspace

Lists.xenproject.org is hosted with RackSpace, monitoring our
servers 24x7x365 and backed by RackSpace's Fanatical Support®.