summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAlon Levy <alevy@redhat.com>2010-11-07 15:26:46 +0200
committerAlon Levy <alevy@redhat.com>2010-11-07 18:51:59 +0200
commit8d68838e519d5040cf4cca83d81a91a9431ab877 (patch)
tree152bc9b0f8bd2dcfa9eb4bf1aeeb56c93506ea28
parentc325cc83ab8da77c6b0b0c1b2179f9660fe4a899 (diff)
downloadspice-8d68838e519d5040cf4cca83d81a91a9431ab877.tar.gz
spice-8d68838e519d5040cf4cca83d81a91a9431ab877.tar.xz
spice-8d68838e519d5040cf4cca83d81a91a9431ab877.zip
server/red_worker: shorten some lines using alias variables
-rw-r--r--server/red_worker.c30
1 files changed, 19 insertions, 11 deletions
diff --git a/server/red_worker.c b/server/red_worker.c
index 59fa6ec2..1ea8bcfb 100644
--- a/server/red_worker.c
+++ b/server/red_worker.c
@@ -8174,13 +8174,14 @@ static void red_send_local_cursor(CursorChannel *cursor_channel, LocalCursor *cu
RedChannel *channel;
SpiceMsgCursorSet cursor_set;
AddBufInfo info;
+ RedWorker *worker = cursor_channel->common.worker;
ASSERT(cursor_channel);
channel = &cursor_channel->common.base;
channel->send_data.header->type = SPICE_MSG_CURSOR_SET;
cursor_set.position = cursor->position;
- cursor_set.visible = cursor_channel->common.worker->cursor_visible;
+ cursor_set.visible = worker->cursor_visible;
fill_cursor(cursor_channel, &cursor_set.cursor, &cursor->base, &info);
spice_marshall_msg_cursor_set(channel->send_data.marshaller, &cursor_set);
@@ -8207,10 +8208,12 @@ static void red_send_cursor(CursorChannel *cursor_channel, CursorItem *cursor)
RedChannel *channel;
RedCursorCmd *cmd;
SpiceMarshaller *m;
+ RedWorker *worker;
ASSERT(cursor_channel);
channel = &cursor_channel->common.base;
+ worker = cursor_channel->common.worker;
m = channel->send_data.marshaller;
cmd = cursor->red_cursor;
@@ -8230,7 +8233,7 @@ static void red_send_cursor(CursorChannel *cursor_channel, CursorItem *cursor)
channel->send_data.header->type = SPICE_MSG_CURSOR_SET;
cursor_set.position = cmd->u.set.position;
- cursor_set.visible = cursor_channel->common.worker->cursor_visible;
+ cursor_set.visible = worker->cursor_visible;
fill_cursor(cursor_channel, &cursor_set.cursor, cursor, &info);
spice_marshall_msg_cursor_set(m, &cursor_set);
@@ -8551,17 +8554,19 @@ static void red_disconnect_channel(RedChannel *channel)
static void red_disconnect_display(RedChannel *channel)
{
DisplayChannel *display_channel;
+ CommonChannel *common = SPICE_CONTAINEROF(channel, CommonChannel, base);
+ RedWorker *worker;
if (!channel || !channel->peer) {
return;
}
-
+ worker = common->worker;
display_channel = (DisplayChannel *)channel;
- ASSERT(display_channel == display_channel->common.worker->display_channel);
+ ASSERT(display_channel == worker->display_channel);
#ifdef COMPRESS_STAT
print_compress_stats(display_channel);
#endif
- display_channel->common.worker->display_channel = NULL;
+ worker->display_channel = NULL;
red_display_unshare_stream_buf(display_channel);
red_release_pixmap_cache(display_channel);
red_release_glz(display_channel);
@@ -9973,6 +9978,8 @@ static void handle_dev_input(EventListener *listener, uint32_t events)
{
RedWorker *worker = SPICE_CONTAINEROF(listener, RedWorker, dev_listener);
RedWorkerMessage message;
+ RedChannel *cursor_red_channel = &worker->cursor_channel->common.base;
+ RedChannel *display_red_channel = &worker->display_channel->common.base;
int ring_is_empty;
read_message(worker->channel, &message);
@@ -9991,8 +9998,9 @@ static void handle_dev_input(EventListener *listener, uint32_t events)
display_channel_push(worker);
}
if (worker->qxl->st->qif->flush_resources(worker->qxl) == 0) {
- red_printf("oom current %u pipe %u", worker->current_size, worker->display_channel ?
- worker->display_channel->common.base.pipe_size : 0);
+ red_printf("oom current %u pipe %u", worker->current_size,
+ worker->display_channel ?
+ display_red_channel->pipe_size : 0);
red_free_some(worker);
worker->qxl->st->qif->flush_resources(worker->qxl);
}
@@ -10006,11 +10014,11 @@ static void handle_dev_input(EventListener *listener, uint32_t events)
red_wait_outgoing_item((RedChannel *)worker->cursor_channel);
if (worker->cursor_channel) {
- red_pipe_add_type(&worker->cursor_channel->common.base, PIPE_ITEM_TYPE_INVAL_CURSOR_CACHE);
- if (!worker->cursor_channel->common.base.migrate) {
- red_pipe_add_verb(&worker->cursor_channel->common.base, SPICE_MSG_CURSOR_RESET);
+ red_pipe_add_type(cursor_red_channel, PIPE_ITEM_TYPE_INVAL_CURSOR_CACHE);
+ if (!cursor_red_channel->migrate) {
+ red_pipe_add_verb(cursor_red_channel, SPICE_MSG_CURSOR_RESET);
}
- ASSERT(!worker->cursor_channel->common.base.send_data.item);
+ ASSERT(!cursor_red_channel->send_data.item);
worker->cursor_visible = TRUE;
worker->cursor_position.x = worker->cursor_position.y = 0;