Re: [PATCH v3 04/34] Adapt to VIR_STRDUP and VIR_STRNDUP in src/cpu/*

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

 



On 07.05.2013 11:15, Michal Privoznik wrote:
> On 07.05.2013 00:00, Eric Blake wrote:
>> On 05/03/2013 08:53 AM, Michal Privoznik wrote:
>>> ---
>>>  src/cpu/cpu_generic.c |  8 ++++----
>>>  src/cpu/cpu_map.c     |  3 ++-
>>>  src/cpu/cpu_powerpc.c | 13 ++++++-------
>>>  src/cpu/cpu_x86.c     | 10 +++++-----
>>>  4 files changed, 17 insertions(+), 17 deletions(-)
> 
>>
>>> +++ b/src/cpu/cpu_powerpc.c
>>> @@ -333,9 +333,8 @@ ppcDecode(virCPUDefPtr cpu,
>>>          goto cleanup;
>>>      }
>>>  
>>> -    if (!(cpu->model = strdup(model->name)) ||
>>> -        (model->vendor && !(cpu->vendor = strdup(model->vendor->name)))) {
>>> -        virReportOOMError();
>>> +    if (VIR_STRDUP(cpu->model, model->name) < 0 ||
>>> +        (model->vendor && VIR_STRDUP(cpu->vendor, model->vendor->name) < 0)) {
>>
>> Another case where not requiring ATTRIBUTE_NONNNULL(2) on VIR_STRDUP
>> would be handy.  I think I've convinced myself we should go that route.
>>  Maybe it would help if I post a patch showing what I'm thinking?
> 
> Yep. you're completely right. However, the 1st patch is already pushed
> with ATTRIBUTE_NONNULL(2). So do you want me to post a fix dropping the
> useless attribute and pushing this without it, or ..,?

AAh, I've just noticed (and ACKed) your cleanup patch set. So I'll wait
until you push it after which I'll push this one.

Michal

--
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]