[libvirt] [PATCH 1/2] Fix guestfwdTarget indentation in domain.rng

* docs/schemas/domain.rng: Fix up some 4 space indentation --- docs/schemas/domain.rng | 10 +++++----- 1 files changed, 5 insertions(+), 5 deletions(-) diff --git a/docs/schemas/domain.rng b/docs/schemas/domain.rng index b75f17e..1bf44fd 100644 --- a/docs/schemas/domain.rng +++ b/docs/schemas/domain.rng @@ -1052,11 +1052,11 @@ </define> <define name="guestfwdTarget"> <element name="target"> - <attribute name="type"> - <value>guestfwd</value> - </attribute> - <attribute name="address"/> - <attribute name="port"/> + <attribute name="type"> + <value>guestfwd</value> + </attribute> + <attribute name="address"/> + <attribute name="port"/> </element> </define> <define name="channel"> -- 1.6.2.5

This patch removes qemudBuildCommandLineChrDevTargetStr and inlines its single use. It was intended to be generic, but on reflection this can't work. Instead it just makes the code slightly harder to read. * src/qemu/qemu_conf.c: Remove and inline qemudBuildCommandLineChrDevTargetStr --- src/qemu/qemu_conf.c | 32 ++++++++------------------------ 1 files changed, 8 insertions(+), 24 deletions(-) diff --git a/src/qemu/qemu_conf.c b/src/qemu/qemu_conf.c index 62b42fe..c807688 100644 --- a/src/qemu/qemu_conf.c +++ b/src/qemu/qemu_conf.c @@ -1495,29 +1495,6 @@ static void qemudBuildCommandLineChrDevChardevStr(virDomainChrDefPtr dev, } } -static int qemudBuildCommandLineChrDevTargetStr(virDomainChrDefPtr dev, - const char *const id, - virBufferPtr buf) -{ - int ret = 0; - const char *addr = NULL; - - int port; - switch (dev->targetType) { - case VIR_DOMAIN_CHR_TARGET_TYPE_GUESTFWD: - addr = virSocketFormatAddr(dev->target.addr); - port = virSocketGetPort(dev->target.addr); - - virBufferVSprintf(buf, "user,guestfwd=tcp:%s:%i-chardev:%s", - addr, port, id); - - VIR_FREE(addr); - break; - } - - return ret; -} - static void qemudBuildCommandLineChrDevStr(virDomainChrDefPtr dev, virBufferPtr buf) { @@ -2205,7 +2182,14 @@ int qemudBuildCommandLine(virConnectPtr conn, ADD_ARG_LIT("-chardev"); ADD_ARG(virBufferContentAndReset(&buf)); - qemudBuildCommandLineChrDevTargetStr(channel, id, &buf); + const char *addr = virSocketFormatAddr(channel->target.addr); + int port = virSocketGetPort(channel->target.addr); + + virBufferVSprintf(&buf, "user,guestfwd=tcp:%s:%i-chardev:%s", + addr, port, id); + + VIR_FREE(addr); + if (virBufferError(&buf)) goto error; -- 1.6.2.5

On Fri, Nov 13, 2009 at 12:42:12PM +0000, Matthew Booth wrote:
This patch removes qemudBuildCommandLineChrDevTargetStr and inlines its single use. It was intended to be generic, but on reflection this can't work. Instead it just makes the code slightly harder to read.
* src/qemu/qemu_conf.c: Remove and inline qemudBuildCommandLineChrDevTargetStr --- src/qemu/qemu_conf.c | 32 ++++++++------------------------ 1 files changed, 8 insertions(+), 24 deletions(-)
Okay, I have applied and pushed the 2 cleanup patches, thanks ! Daniel -- Daniel Veillard | libxml Gnome XML XSLT toolkit http://xmlsoft.org/ daniel@veillard.com | Rpmfind RPM search engine http://rpmfind.net/ http://veillard.com/ | virtualization library http://libvirt.org/
participants (2)
-
Daniel Veillard
-
Matthew Booth