util: remove unnecessary needSize

Use toadd->use directly.

Signed-off-by: Chen Hanxiao <chenhanxiao@gmail.com>
This commit is contained in:
Chen Hanxiao 2015-11-14 14:56:06 +08:00 committed by Martin Kletzander
parent d3fa510a75
commit e340013ea8

View 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);