From dfbac622bf9cbff7b4bdcabe78299621821ca61e Mon Sep 17 00:00:00 2001 From: Dan McGee Date: Thu, 16 Feb 2012 23:30:10 -0600 Subject: Use memcpy call in red_channel_create 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. Signed-off-by: Dan McGee --- server/red_channel.c | 9 +-------- 1 file changed, 1 insertion(+), 8 deletions(-) (limited to 'server/red_channel.c') diff --git a/server/red_channel.c b/server/red_channel.c index 09161187..59e6af6d 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; -- cgit