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

Michal Privoznik mprivozn at redhat.com
Tue Oct 3 12:01:25 UTC 2017


On 10/03/2017 01:52 PM, Martin Kletzander wrote:
> 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 =)

No, I was referring to return in the middle of the function. And then to
freeing variables before goto statements, and not freeing them under the
cleanup label. Whatever,

> 
> ACK

this is important to me :-)

Thanks,
Michal




More information about the libvir-list mailing list