On Tue, Mar 11, 2025 at 07:59:28PM +0400, marcandre.lur...@redhat.com wrote:
> From: Marc-André Lureau <marcandre.lur...@redhat.com>
> 
> Buffer is slightly more advanced than GByteArray, since it has a
> cursor/position. But vdagent code doesn't need it. This simplify a bit
> the code, and migration state.
> 
> Signed-off-by: Marc-André Lureau <marcandre.lur...@redhat.com>
> ---
>  ui/vdagent.c | 25 ++++++++++++-------------
>  1 file changed, 12 insertions(+), 13 deletions(-)
> 
> diff --git a/ui/vdagent.c b/ui/vdagent.c
> index 724eff972f..ddd8990318 100644
> --- a/ui/vdagent.c
> +++ b/ui/vdagent.c

> @@ -177,9 +177,8 @@ static void vdagent_send_msg(VDAgentChardev *vd, 
> VDAgentMessage *msg)
>          if (chunk.size > 1024) {
>              chunk.size = 1024;
>          }
> -        buffer_reserve(&vd->outbuf, sizeof(chunk) + chunk.size);
> -        buffer_append(&vd->outbuf, &chunk, sizeof(chunk));
> -        buffer_append(&vd->outbuf, msgbuf + msgoff, chunk.size);
> +        g_byte_array_append(vd->outbuf, (void*)&chunk, sizeof (chunk));

nit-pick, QEMU style doesn't usually have a space between 'sizeof' and '('

> +        g_byte_array_append(vd->outbuf, msgbuf + msgoff, chunk.size);
>          msgoff += chunk.size;
>      }
>      vdagent_send_buf(vd);

Reviewed-by: Daniel P. Berrangé <berra...@redhat.com>


With regards,
Daniel
-- 
|: https://berrange.com      -o-    https://www.flickr.com/photos/dberrange :|
|: https://libvirt.org         -o-            https://fstop138.berrange.com :|
|: https://entangle-photo.org    -o-    https://www.instagram.com/dberrange :|


Reply via email to