From: Chen Hanxiao <chenhanxiao(a)gmail.com>
Use toadd->use directly.
Signed-off-by: Chen Hanxiao <chenhanxiao(a)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
Show replies by date