[libvirt] [PATCH 2/8] Introduce virDomainInterfaceFree API

Michal Privoznik mprivozn at redhat.com
Fri Dec 21 16:10:05 UTC 2012


On 21.12.2012 17:01, Michal Privoznik wrote:
> On 21.12.2012 16:52, Daniel P. Berrange wrote:
>> On Fri, Dec 21, 2012 at 04:49:37PM +0100, Michal Privoznik wrote:
>>> This is just a free function for array of virDomainInterfacePtr as
>>> returned by virDomainInterfacesAddresses API.
>>> ---
>>>  include/libvirt/libvirt.h.in |  3 +++
>>>  python/generator.py          |  1 +
>>>  src/libvirt.c                | 31 +++++++++++++++++++++++++++++++
>>>  src/libvirt_public.syms      |  1 +
>>>  4 files changed, 36 insertions(+)
>>>
>>> diff --git a/include/libvirt/libvirt.h.in b/include/libvirt/libvirt.h.in
>>> index 3eb7ced..d40c4f8 100644
>>> --- a/include/libvirt/libvirt.h.in
>>> +++ b/include/libvirt/libvirt.h.in
>>> @@ -4613,6 +4613,9 @@ int virDomainInterfacesAddresses(virDomainPtr domain,
>>>                                   unsigned int method,
>>>                                   unsigned int flags);
>>>  
>>> +void virDomainInterfaceFree(virDomainInterfacePtr ifaces,
>>> +                            int count);
>>
>> Ewww, no. Please just have
>>
>>   void virDomainInterfaceFree(virDomainInterfacePtr iface);
>>
>> Daniel
>>
> 
> You mean to free just one item within an array? So users should do:
> 
> for (i = 0; i < ifaces_count; i++)
>   virDomainInterfaceFree(ifaces[i]);
> VIR_FREE(ifaces)
> 
> then? Why would we want to enforce them to do something like that?
> (I am not saying you approach is bad, I just don't understand it)
> 

Aah. Now, after I read your reply to 1/8 I understand. Okay, I think I
can do that.

> Michal
> 
> --
> libvir-list mailing list
> libvir-list at redhat.com
> https://www.redhat.com/mailman/listinfo/libvir-list
> 




More information about the libvir-list mailing list