[libvirt] [PATCHv2 2/5] storage: prepare for refactoring

Eric Blake eblake at redhat.com
Fri Feb 15 21:26:29 UTC 2013


On 02/15/2013 02:22 PM, Peter Krempa wrote:

>> -    return 0;
>> +done:
>> +    ret = meta;
> 
> Um, is the ret variable really needed here? The only value it can take
> is "meta" and return it right after. If this isn't needed in the next
> patches I'd rather go for "return meta" here.
> 
>> +cleanup:
> 
> Rename this to "error"
> 
>> +    return ret;
> 
> And "return NULL" instead;

Next patch turns moves the allocation into this function, at which point
the tail end becomes:

done:
    ret = meta;
    meta = NULL;

cleanup:
    virStorageFileFreeMetadata(meta);
    VIR_FREE(buf);
    return ret;


> 
>>   }
>>
>>
> 
> ACK if:
> 1) this change will be needed later
> 2) tweaked according to my suggestions

I'm going with option 1 - the labels make more sense once patch 3 is in
place.

-- 
Eric Blake   eblake redhat com    +1-919-301-3266
Libvirt virtualization library http://libvirt.org

-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 621 bytes
Desc: OpenPGP digital signature
URL: <http://listman.redhat.com/archives/libvir-list/attachments/20130215/cf83cb76/attachment-0001.sig>


More information about the libvir-list mailing list