Re: [PATCH 6/6] qemu_driver: use VIR_AUTOFREE() with strings 3/3

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

 



On Wed, Sep 18, 2019 at 11:56:58AM -0300, Daniel Henrique Barboza wrote:
> VIR_AUTOFREE is a beautiful macro. Let's use it across the board
> inside qemu_driver.c to make the code a bit tidier and smaller,
> sparing VIR_FREE() calls and sometimes a whole 'cleanup'
> label.
>
> This is the last part of this change.
>
> Signed-off-by: Daniel Henrique Barboza <danielhb413@xxxxxxxxx>
> ---
...

>
> @@ -22506,7 +22479,7 @@ qemuDomainRenameCallback(virDomainObjPtr vm,
>          if (virFileIsLink(old_dom_autostart_link) &&
>              unlink(old_dom_autostart_link) < 0) {
>              virReportSystemError(errno,
> -                                 _("Failed to delete symlink '%s'"),
> +                                _("Failed to delete symlink '%s'"),

^Undesirable hunk

Same as with VIR_AUTOUNREF, this focuses on strings only, I'd extend this also
for other primitive scalar pointers:

cpuwait in qemuDomainGetStatsVcpu
flags in qemuStateStop

There are other occasions at which we use VIR_FREE and could be replaced, but
those are not scalar type pointers and I the policy I believe we settled with
is not to use VIR_AUTOFREE with compound types, instead a dedicated VIR_AUTOPTR
should be created.

Erik

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

  Powered by Linux