[Spice-devel] [PATCH 4/7] Use memcpy call in red_channel_create
Alon Levy
alevy at redhat.com
Fri Feb 17 00:55:41 PST 2012
On Thu, Feb 16, 2012 at 11:30:10PM -0600, Dan McGee wrote:
> Rather than assign the callbacks one-by-one, we can just memcpy the
> struct into the one we have allocated in our RedChannel object, which is
> much more efficient, not to mention future-proof when more callbacks are
> added.
ACK.
>
> Signed-off-by: Dan McGee <dpmcgee at gmail.com>
> ---
> server/red_channel.c | 9 +--------
> 1 files changed, 1 insertions(+), 8 deletions(-)
>
> diff --git a/server/red_channel.c b/server/red_channel.c
> index fe50d2f..767f907 100644
> --- a/server/red_channel.c
> +++ b/server/red_channel.c
> @@ -610,14 +610,7 @@ RedChannel *red_channel_create(int size,
> channel->type = type;
> channel->id = id;
> channel->handle_acks = handle_acks;
> - channel->channel_cbs.on_disconnect = channel_cbs->on_disconnect;
> - channel->channel_cbs.send_item = channel_cbs->send_item;
> - channel->channel_cbs.release_item = channel_cbs->release_item;
> - channel->channel_cbs.hold_item = channel_cbs->hold_item;
> - channel->channel_cbs.handle_migrate_flush_mark = channel_cbs->handle_migrate_flush_mark;
> - channel->channel_cbs.handle_migrate_data = channel_cbs->handle_migrate_data;
> - channel->channel_cbs.handle_migrate_data_get_serial = channel_cbs->handle_migrate_data_get_serial;
> - channel->channel_cbs.config_socket = channel_cbs->config_socket;
> + memcpy(&channel->channel_cbs, channel_cbs, sizeof(ChannelCbs));
>
> channel->core = core;
> channel->migrate = migrate;
> --
> 1.7.9.1
>
> _______________________________________________
> Spice-devel mailing list
> Spice-devel at lists.freedesktop.org
> http://lists.freedesktop.org/mailman/listinfo/spice-devel
More information about the Spice-devel
mailing list