On Tue, 2017-02-07 at 11:59 +0100, Christophe Fergeau wrote: > There is only one implementation of OutgoingHandler which relies > OutgoingHandler::opaque being a RedChannelClient. This commit makes > this > explicit in order to get rid of the OutgoingHandler::opaque data > member. Same comment about mentioning the function rename. > --- > server/red-channel-client-private.h | 1 - > server/red-channel-client.c | 21 +++++++++++---------- > 2 files changed, 11 insertions(+), 11 deletions(-) > > diff --git a/server/red-channel-client-private.h b/server/red- > channel-client-private.h > index a7167e5..08ac6ca 100644 > --- a/server/red-channel-client-private.h > +++ b/server/red-channel-client-private.h > @@ -41,7 +41,6 @@ typedef struct RedChannelClientConnectivityMonitor > { > } RedChannelClientConnectivityMonitor; > > typedef struct OutgoingHandler { > - void *opaque; > struct iovec vec_buf[IOV_MAX]; > int vec_size; > struct iovec *vec; > diff --git a/server/red-channel-client.c b/server/red-channel- > client.c > index 59f8805..c92434b 100644 > --- a/server/red-channel-client.c > +++ b/server/red-channel-client.c > @@ -268,7 +268,6 @@ static void > red_channel_client_constructed(GObject *object) > { > RedChannelClient *self = RED_CHANNEL_CLIENT(object); > > - self->priv->outgoing.opaque = self; > self->priv->outgoing.pos = 0; > self->priv->outgoing.size = 0; > > @@ -1024,8 +1023,10 @@ static void > red_channel_client_release_msg_buf(RedChannelClient *client, > g_return_if_reached(); > } > > -static void red_peer_handle_outgoing(RedsStream *stream, > OutgoingHandler *handler) > +static void red_channel_client_handle_outgoing(RedChannelClient > *client) Same comment about the 'client' vs. 'rcc' function argument. > { > + RedsStream *stream = client->priv->stream; > + OutgoingHandler *handler = &client->priv->outgoing; > ssize_t n; > > if (!stream) { > @@ -1034,35 +1035,35 @@ static void > red_peer_handle_outgoing(RedsStream *stream, OutgoingHandler *handle > > if (handler->size == 0) { > handler->vec = handler->vec_buf; > - handler->size = red_channel_client_get_out_msg_size(handler- > >opaque); > + handler->size = red_channel_client_get_out_msg_size(client); > if (!handler->size) { // nothing to be sent > return; > } > } > > for (;;) { > - red_channel_client_prepare_out_msg(handler->opaque, handler- > >vec, &handler->vec_size, handler->pos); > + red_channel_client_prepare_out_msg(client, handler->vec, > &handler->vec_size, handler->pos); > n = reds_stream_writev(stream, handler->vec, handler- > >vec_size); > if (n == -1) { > switch (errno) { > case EAGAIN: > - red_channel_client_on_out_block(handler->opaque); > + red_channel_client_on_out_block(client); > return; > case EINTR: > continue; > case EPIPE: > /* FIXME: handle disconnection in caller */ > - red_channel_client_disconnect(handler->opaque); > + red_channel_client_disconnect(client); > return; > default: > /* FIXME: handle disconnection in caller */ > spice_printerr("%s", strerror(errno)); > - red_channel_client_disconnect(handler->opaque); > + red_channel_client_disconnect(client); > return; > } > } else { > handler->pos += n; > - red_channel_client_on_output(handler->opaque, n); > + red_channel_client_on_output(client, n); > if (handler->pos == handler->size) { // finished writing > data > /* reset handler before calling on_msg_done, since > it > * can trigger another call to > red_peer_handle_outgoing (when > @@ -1070,7 +1071,7 @@ static void red_peer_handle_outgoing(RedsStream > *stream, OutgoingHandler *handle > handler->vec = handler->vec_buf; > handler->pos = 0; > handler->size = 0; > - red_channel_client_on_out_msg_done(handler->opaque); > + red_channel_client_on_out_msg_done(client); > return; > } > } > @@ -1239,7 +1240,7 @@ void > red_channel_client_receive(RedChannelClient *rcc) > void red_channel_client_send(RedChannelClient *rcc) > { > g_object_ref(rcc); > - red_peer_handle_outgoing(rcc->priv->stream, &rcc->priv- > >outgoing); > + red_channel_client_handle_outgoing(rcc); > g_object_unref(rcc); > } > Acked-by: Jonathon Jongsma <jjongsma@xxxxxxxxxx> _______________________________________________ Spice-devel mailing list Spice-devel@xxxxxxxxxxxxxxxxxxxxx https://lists.freedesktop.org/mailman/listinfo/spice-devel