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

Ján Tomko jtomko at redhat.com
Wed Jul 8 09:54:15 UTC 2020


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 at redhat.com>
>---
> 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 at redhat.com>

Jano
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 488 bytes
Desc: not available
URL: <http://listman.redhat.com/archives/libvir-list/attachments/20200708/810de12f/attachment-0001.sig>


More information about the libvir-list mailing list