There is just one caller, inline the code. This also optimizes the code as we no longer have to calculate length of the output XML as it's actually stored in the buffer struct. Signed-off-by: Peter Krempa <pkrempa@xxxxxxxxxx> --- src/qemu/qemu_migration_cookie.c | 20 ++++---------------- 1 file changed, 4 insertions(+), 16 deletions(-) diff --git a/src/qemu/qemu_migration_cookie.c b/src/qemu/qemu_migration_cookie.c index f5c16a8d16..1596ab914b 100644 --- a/src/qemu/qemu_migration_cookie.c +++ b/src/qemu/qemu_migration_cookie.c @@ -861,20 +861,6 @@ qemuMigrationCookieXMLFormat(virQEMUDriverPtr driver, } -static char * -qemuMigrationCookieXMLFormatStr(virQEMUDriverPtr driver, - virQEMUCapsPtr qemuCaps, - qemuMigrationCookiePtr mig) -{ - g_auto(virBuffer) buf = VIR_BUFFER_INITIALIZER; - - if (qemuMigrationCookieXMLFormat(driver, qemuCaps, &buf, mig) < 0) - return NULL; - - return virBufferContentAndReset(&buf); -} - - static qemuMigrationCookieGraphicsPtr qemuMigrationCookieGraphicsXMLParse(xmlXPathContextPtr ctxt) { @@ -1397,6 +1383,7 @@ qemuMigrationCookieFormat(qemuMigrationCookiePtr mig, unsigned int flags) { qemuDomainObjPrivatePtr priv = dom->privateData; + g_auto(virBuffer) buf = VIR_BUFFER_INITIALIZER; if (!cookieout || !cookieoutlen) return 0; @@ -1441,10 +1428,11 @@ qemuMigrationCookieFormat(qemuMigrationCookiePtr mig, qemuMigrationCookieAddCaps(mig, dom, party) < 0) return -1; - if (!(*cookieout = qemuMigrationCookieXMLFormatStr(driver, priv->qemuCaps, mig))) + if (qemuMigrationCookieXMLFormat(driver, priv->qemuCaps, &buf, mig) < 0) return -1; - *cookieoutlen = strlen(*cookieout) + 1; + *cookieoutlen = virBufferUse(&buf) + 1; + *cookieout = virBufferContentAndReset(&buf); VIR_DEBUG("cookielen=%d cookie=%s", *cookieoutlen, *cookieout); -- 2.26.2