On 05/20/2013 06:12 AM, Michal Privoznik wrote:
>> I've only found one that doesn't:
>> src/storage/parthelper.c:
>>         if (virFileResolveLink(path, &canonical_path) != 0) {
>>
>> But you still should update the comments stating that they return 0 on 
>> success.
>>
> 
> Huh, "Returns 0 or 1 on success" is not nice. So I'd rather change the
> return value.

While the 0/1 distinction makes sense for VIR_STRDUP (as you can argue
that knowing whether the caller passed NULL is sometimes useful), most
other larger functions that happen to end on a VIR_STRDUP aren't really
using the 0/1 as a differentiation on whether the user passed in NULL,
but are always dup'ing a non-NULL string.  But returning 1 when it
conveys no real information seems awkward.  Therefore, I think I'd
rather see you rewrite code to continue to return explicit 0 on
functions that were previously returning 0, instead of optimizing by
passing the VIR_STRDUP return value straight through.

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

Attachment: signature.asc
Description: OpenPGP digital signature

--
libvir-list mailing list
libvir-list@redhat.com
https://www.redhat.com/mailman/listinfo/libvir-list

Reply via email to