diff options
author | Dan McGee <dpmcgee@gmail.com> | 2012-02-16 23:30:10 -0600 |
---|---|---|
committer | Alon Levy <alevy@redhat.com> | 2012-02-21 10:20:45 +0200 |
commit | dfbac622bf9cbff7b4bdcabe78299621821ca61e (patch) | |
tree | fb866b19f96b462c3683b4526ac37a77188f95de /server/red_channel.c | |
parent | 10d79a35c1f571fe91615dd0ffa0f67a903b69c2 (diff) |
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 <dpmcgee@gmail.com>
Diffstat (limited to 'server/red_channel.c')
-rw-r--r-- | 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 0916118..59e6af6 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; |