[Spice-devel] [PATCH spice-server] red-channel-client: Do not allocate iovec array statically in the class
Christophe Fergeau
cfergeau at redhat.com
Mon Jun 18 12:18:42 UTC 2018
Acked-by: Christophe Fergeau <cfergeau at redhat.com>
On Mon, Jun 18, 2018 at 08:35:52AM +0100, Frediano Ziglio wrote:
> This array is just used locally in red_channel_client_handle_outgoing
> so declare it there.
>
> Signed-off-by: Frediano Ziglio <fziglio at redhat.com>
> ---
> server/red-channel-client.c | 9 ++++-----
> 1 file changed, 4 insertions(+), 5 deletions(-)
>
> diff --git a/server/red-channel-client.c b/server/red-channel-client.c
> index 893a764d..5d256eca 100644
> --- a/server/red-channel-client.c
> +++ b/server/red-channel-client.c
> @@ -101,8 +101,6 @@ typedef struct RedChannelClientConnectivityMonitor {
> } RedChannelClientConnectivityMonitor;
>
> typedef struct OutgoingMessageBuffer {
> - struct iovec vec[IOV_MAX];
> - int vec_size;
> int pos;
> int size;
> } OutgoingMessageBuffer;
> @@ -1081,10 +1079,11 @@ static void red_channel_client_handle_outgoing(RedChannelClient *rcc)
> }
>
> for (;;) {
> - buffer->vec_size =
> - red_channel_client_prepare_out_msg(rcc, buffer->vec, G_N_ELEMENTS(buffer->vec),
> + struct iovec vec[IOV_MAX];
> + int vec_size =
> + red_channel_client_prepare_out_msg(rcc, vec, G_N_ELEMENTS(vec),
> buffer->pos);
> - n = red_stream_writev(stream, buffer->vec, buffer->vec_size);
> + n = red_stream_writev(stream, vec, vec_size);
> if (n == -1) {
> switch (errno) {
> case EAGAIN:
> --
> 2.17.1
>
> _______________________________________________
> Spice-devel mailing list
> Spice-devel at lists.freedesktop.org
> https://lists.freedesktop.org/mailman/listinfo/spice-devel
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 833 bytes
Desc: not available
URL: <https://lists.freedesktop.org/archives/spice-devel/attachments/20180618/bd59045d/attachment.sig>
More information about the Spice-devel
mailing list