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

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



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)

Michal


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