Re: [PATCH 2/8] Add qemuMonitorGetObjectProperty() method for QMP qom-get command

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On 07/03/2013 02:03 PM, Michal Privoznik wrote:
> On 02.07.2013 15:39, John Ferlan wrote:
>> +    case QEMU_MONITOR_OBJECT_PROPERTY_STRING:
>> +        tmp = virJSONValueGetString(data);
>> +        if (tmp && VIR_STRDUP(prop->val.str, tmp) < 0)
> 
> Lose the 'tmp' here as VIR_STRDUP will check it for NULL anyway. In
> fact, these lines can be rewritten into a single line:
> 
> ret = VIR_STRDUP(prop->val.str, tmp);
> 
>> +            goto cleanup;
>> +        if (tmp)
>> +            ret = 0;
>> +        break;

Not at all. Before it returns 0 if GetString returned something.
After your change, ret will be 1 in that case, and 0 if GetString returned
nothing.

Jan

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




[Index of Archives]     [Virt Tools]     [Libvirt Users]     [Lib OS Info]     [Fedora Users]     [Fedora Desktop]     [Fedora SELinux]     [Big List of Linux Books]     [Yosemite News]     [KDE Users]     [Fedora Tools]