[PATCH] util: remove unnecessary needSize

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

 



From: Chen Hanxiao <chenhanxiao@xxxxxxxxx>

Use toadd->use directly.

Signed-off-by: Chen Hanxiao <chenhanxiao@xxxxxxxxx>
---
 src/util/virbuffer.c | 5 +----
 1 file changed, 1 insertion(+), 4 deletions(-)

diff --git a/src/util/virbuffer.c b/src/util/virbuffer.c
index 5b338f8..55dad37 100644
--- a/src/util/virbuffer.c
+++ b/src/util/virbuffer.c
@@ -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);
-- 
1.9.0


--
libvir-list mailing list
libvir-list@xxxxxxxxxx
https://www.redhat.com/mailman/listinfo/libvir-list



[Index of Archives]     [Virt Tools]     [Libvirt Users]     [Lib OS Info]     [Fedora Users]     [Fedora Desktop]     [Fedora SELinux]     [Big List of Linux Books]     [Yosemite News]     [KDE Users]     [Fedora Tools]