[libvirt] [PATCH v2 1/3] virDomainDeviceInfoParseXML: Separate address parsing into separate func

Martin Kletzander mkletzan at redhat.com
Tue Oct 3 11:52:36 UTC 2017


On Tue, Oct 03, 2017 at 12:58:57PM +0200, Michal Privoznik wrote:
>There's one 'return' in the middle of the function body. It's
>very easy to miss and so it makes adding new code harder. Also
>the function doesn't follow our style 100%.
>
>Signed-off-by: Michal Privoznik <mprivozn at redhat.com>
>---
> src/conf/domain_conf.c | 174 ++++++++++++++++++++++++++-----------------------
> 1 file changed, 93 insertions(+), 81 deletions(-)
>
>diff --git a/src/conf/domain_conf.c b/src/conf/domain_conf.c
>index 87192eb2d..0bc2e2f94 100644
>--- a/src/conf/domain_conf.c
>+++ b/src/conf/domain_conf.c
>@@ -6364,102 +6452,26 @@ virDomainDeviceInfoParseXML(xmlNodePtr node,
>     }
>
>     if (rom) {
>-        char *rombar = virXMLPropString(rom, "bar");
>-        if (rombar &&
>+        if ((rombar = virXMLPropString(rom, "bar")) &&

If this is what you meant by "follow our coding style 100%", then I
think you are wrong since this (IMHO bad) style is not explicitly
mentioned, only (mis)used once.  But I'm not fighting over it since I
know more people prefer less readable code that saves one or two lines =)

ACK
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 833 bytes
Desc: Digital signature
URL: <http://listman.redhat.com/archives/libvir-list/attachments/20171003/f1280b8c/attachment-0001.sig>


More information about the libvir-list mailing list