]> xenbits.xensource.com Git - people/liuw/libxenctrl-split/libvirt.git/commitdiff
util: remove unnecessary needSize
authorChen Hanxiao <chenhanxiao@gmail.com>
Sat, 14 Nov 2015 06:56:06 +0000 (14:56 +0800)
committerMartin Kletzander <mkletzan@redhat.com>
Mon, 16 Nov 2015 10:03:04 +0000 (11:03 +0100)
Use toadd->use directly.

Signed-off-by: Chen Hanxiao <chenhanxiao@gmail.com>
src/util/virbuffer.c

index 5b338f886f0c8433e4747b6e9fa1b519456acb4e..55dad37b18f38f90e83c1e18413debb6f4734214 100644 (file)
@@ -186,8 +186,6 @@ virBufferAdd(virBufferPtr buf, const char *str, int len)
 void
 virBufferAddBuffer(virBufferPtr buf, virBufferPtr toadd)
 {
-    unsigned int needSize;
-
     if (!toadd)
         return;
 
@@ -200,8 +198,7 @@ virBufferAddBuffer(virBufferPtr buf, virBufferPtr toadd)
         goto done;
     }
 
-    needSize = buf->use + toadd->use;
-    if (virBufferGrow(buf, needSize - buf->use) < 0)
+    if (virBufferGrow(buf, toadd->use) < 0)
         goto done;
 
     memcpy(&buf->content[buf->use], toadd->content, toadd->use);