[libvirt] [PATCH v3 06/10] qemu_driver: use VIR_AUTOFREE() with strings 1/3

Daniel Henrique Barboza danielhb413 at gmail.com
Wed Oct 16 14:56:59 UTC 2019



On 10/16/19 11:28 AM, Ján Tomko wrote:
> On Wed, Oct 16, 2019 at 11:14:05AM -0300, Daniel Henrique Barboza wrote:
>>
>>
>> On 10/16/19 10:49 AM, Ján Tomko wrote:
>>> On Tue, Oct 15, 2019 at 05:08:48PM -0300, Daniel Henrique Barboza 
>>> wrote:
>>>> Using VIR_AUTOFREE() in all strings of qemu_driver.c make the code
>>>> a bit tidier and smaller, sparing VIR_FREE() calls and sometimes a
>>>> whole 'cleanup' label.
>>>
>>> These patches would look much better split by:
>>> * individual functions (in case you do rework multiple things at once)
>>
>> Do you mean sending an individual patch for any function that might
>> have, say, 2+ changes in it? For example, if the same function
>> was changed to use g_autoptr and g_autofree and perhaps
>> that causes a label to be dropped, this can be an individual patch?
>
> Yes, but if you convert a lot of functions, that would result in a lot
> of patches.

Just checked. There's just a couple of functions I messed around in a
non-trivial way (moved string declarations inside loops to avoid a
VIR_FREE call, lots of VIR_FREE calls being removed and so on).

I can send them in separated patches (perhaps both in the same patch,
I think the functions are related), then proceed with the more trivial
changes of inserting g_autoptr, g_autofree and removing labels in
separated patches each.


DHB


>
> Sending one patch per function is more viable for the cases where you
> need to refactor it in order to add some functionality later (see
> Jirka's series for example). For mass conversion for the sake of
> conversion, one patch per change is better.
>
> Jano
>
>>
>>
>>> * individual changes, i.e.
>>>  * g_autofree for scalars
>>>  * g_autoptr for pointers and unref
>>>  * possible removal of cleanup labels




More information about the libvir-list mailing list