Re: [PATCH 01/32] bhyve: use g_auto() for all virBuffers

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

 



On a Sunday in 2020, Laine Stump wrote:
In most cases this eliminates one or more calls to
virBufferClearAndReset(), but even when it doesn't it's better because:

1) it makes the code more consistent, making it more likely that new contributors who are "learning by example" will to the right thing.


Long line

2) it protects against future modifications that might have otherwise
needed to add a virBufferClearAndReset()

3) Currently some functions don't call virBufferClearAndReset() only
because they're relying on some subordinate function to call it for
them (e.g. bhyveConnectGetSysinfo() in this patch relies on
virSysinfoFormat() to clear out the buffer when there is an error). I
think this is sloppy behavior, and that the toplevel function that
defines and initializes the buffer should be the function clearing it
at the end.

Signed-off-by: Laine Stump <laine@xxxxxxxxxx>
---
src/bhyve/bhyve_command.c | 15 ++++++---------
src/bhyve/bhyve_driver.c  |  4 ++--
2 files changed, 8 insertions(+), 11 deletions(-)


Reviewed-by: Ján Tomko <jtomko@xxxxxxxxxx>

Jano

Attachment: signature.asc
Description: PGP signature


[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