[Spice-devel] [PATCH 3/4] Remove spicevmc_red_channel_client_get_state()
Frediano Ziglio
fziglio at redhat.com
Fri Nov 4 09:23:54 UTC 2016
>
> This helper function does nothing but cast the return from
> red_channel_client_get_channel(), and it has a confusing name
> (_get_state(), but returns a channel)
Acked-by: Frediano Ziglio <fziglio at redhat.com>
> ---
> server/spicevmc.c | 20 +++++++-------------
> 1 file changed, 7 insertions(+), 13 deletions(-)
>
> diff --git a/server/spicevmc.c b/server/spicevmc.c
> index 1a97b68..49de9cc 100644
> --- a/server/spicevmc.c
> +++ b/server/spicevmc.c
> @@ -424,15 +424,9 @@ static void
> spicevmc_chardev_send_msg_to_client(RedCharDevice *self,
> red_channel_client_pipe_add_push(state->rcc, msg);
> }
>
> -static RedVmcChannel *spicevmc_red_channel_client_get_state(RedChannelClient
> *rcc)
> -{
> - RedChannel *channel = red_channel_client_get_channel(rcc);
> - return RED_VMC_CHANNEL(channel);
> -}
> -
> static void spicevmc_port_send_init(RedChannelClient *rcc)
> {
> - RedVmcChannel *state = spicevmc_red_channel_client_get_state(rcc);
> + RedVmcChannel *state =
> RED_VMC_CHANNEL(red_channel_client_get_channel(rcc));
> SpiceCharDeviceInstance *sin;
> RedPortInitPipeItem *item = spice_malloc(sizeof(RedPortInitPipeItem));
>
> @@ -505,7 +499,7 @@ static void
> spicevmc_red_channel_client_on_disconnect(RedChannelClient *rcc)
> return;
> }
>
> - state = spicevmc_red_channel_client_get_state(rcc);
> + state = RED_VMC_CHANNEL(red_channel_client_get_channel(rcc));
>
> /* partial message which wasn't pushed to device */
> red_char_device_write_buffer_release(state->chardev,
> &state->recv_from_client_buf);
> @@ -543,7 +537,7 @@ static int
> spicevmc_channel_client_handle_migrate_data(RedChannelClient *rcc,
> SpiceMigrateDataSpiceVmc *mig_data;
> RedVmcChannel *state;
>
> - state = spicevmc_red_channel_client_get_state(rcc);
> + state = RED_VMC_CHANNEL(red_channel_client_get_channel(rcc));
>
> header = (SpiceMigrateDataHeader *)message;
> mig_data = (SpiceMigrateDataSpiceVmc *)(header + 1);
> @@ -609,7 +603,7 @@ static int
> spicevmc_red_channel_client_handle_message_parsed(RedChannelClient *r
> SpiceCharDeviceInstance *sin;
> SpiceCharDeviceInterface *sif;
>
> - state = spicevmc_red_channel_client_get_state(rcc);
> + state = RED_VMC_CHANNEL(red_channel_client_get_channel(rcc));
> g_object_get(state->chardev, "sin", &sin, NULL);
> sif = spice_char_device_get_interface(sin);
>
> @@ -645,7 +639,7 @@ static uint8_t
> *spicevmc_red_channel_alloc_msg_rcv_buf(RedChannelClient *rcc,
> RedVmcChannel *state;
> RedClient *client = red_channel_client_get_client(rcc);
>
> - state = spicevmc_red_channel_client_get_state(rcc);
> + state = RED_VMC_CHANNEL(red_channel_client_get_channel(rcc));
>
> switch (type) {
> case SPICE_MSGC_SPICEVMC_DATA:
> @@ -673,7 +667,7 @@ static void
> spicevmc_red_channel_release_msg_rcv_buf(RedChannelClient *rcc,
> {
> RedVmcChannel *state;
>
> - state = spicevmc_red_channel_client_get_state(rcc);
> + state = RED_VMC_CHANNEL(red_channel_client_get_channel(rcc));
>
> switch (type) {
> case SPICE_MSGC_SPICEVMC_DATA:
> @@ -712,7 +706,7 @@ static void
> spicevmc_red_channel_send_migrate_data(RedChannelClient *rcc,
> {
> RedVmcChannel *state;
>
> - state = spicevmc_red_channel_client_get_state(rcc);
> + state = RED_VMC_CHANNEL(red_channel_client_get_channel(rcc));
> red_channel_client_init_send_data(rcc, SPICE_MSG_MIGRATE_DATA, item);
> spice_marshaller_add_uint32(m, SPICE_MIGRATE_DATA_SPICEVMC_MAGIC);
> spice_marshaller_add_uint32(m, SPICE_MIGRATE_DATA_SPICEVMC_VERSION);
Frediano
More information about the Spice-devel
mailing list