[libvirt] [PATCH] util: remove unnecessary needSize

Chen Hanxiao chen_han_xiao at 126.com
Sat Nov 14 04:20:27 UTC 2015


From: Chen Hanxiao <chenhanxiao at gmail.com>

Use toadd->use directly.

Signed-off-by: Chen Hanxiao <chenhanxiao at gmail.com>
---
 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





More information about the libvir-list mailing list