diff options
author | Christophe Fergeau <cfergeau@redhat.com> | 2014-03-25 14:12:40 +0100 |
---|---|---|
committer | Christophe Fergeau <cfergeau@redhat.com> | 2014-04-16 17:11:38 +0200 |
commit | 81427961bd121222681e9275cd5fb4fe7e6e3f25 (patch) | |
tree | e202a358941da8ce029e3263714d6092b025940f | |
parent | 3dd4723e48da6de886963d9781bf53dea65a7e42 (diff) |
Call AsyncRead variables 'async' instead of 'obj'
This is a more explicit name.
-rw-r--r-- | server/reds_stream.c | 60 |
1 files changed, 30 insertions, 30 deletions
diff --git a/server/reds_stream.c b/server/reds_stream.c index b9cddd02..191d8f27 100644 --- a/server/reds_stream.c +++ b/server/reds_stream.c @@ -395,54 +395,54 @@ void reds_stream_set_async_error_handler(RedsStream *stream, stream->priv->async_read.error = error_handler; } -static inline void async_read_clear_handlers(AsyncRead *obj) +static inline void async_read_clear_handlers(AsyncRead *async) { - if (obj->stream->watch) { - reds_stream_remove_watch(obj->stream); + if (async->stream->watch) { + reds_stream_remove_watch(async->stream); } - obj->stream = NULL; + async->stream = NULL; } void async_read_handler(int fd, int event, void *data) { - AsyncRead *obj = (AsyncRead *)data; + AsyncRead *async = (AsyncRead *)data; for (;;) { - int n = obj->end - obj->now; + int n = async->end - async->now; spice_assert(n > 0); - n = reds_stream_read(obj->stream, obj->now, n); + n = reds_stream_read(async->stream, async->now, n); if (n <= 0) { if (n < 0) { switch (errno) { case EAGAIN: - if (!obj->stream->watch) { - obj->stream->watch = core->watch_add(obj->stream->socket, - SPICE_WATCH_EVENT_READ, - async_read_handler, obj); + if (!async->stream->watch) { + async->stream->watch = core->watch_add(async->stream->socket, + SPICE_WATCH_EVENT_READ, + async_read_handler, async); } return; case EINTR: break; default: - async_read_clear_handlers(obj); - if (obj->error) { - obj->error(obj->opaque, errno); + async_read_clear_handlers(async); + if (async->error) { + async->error(async->opaque, errno); } return; } } else { - async_read_clear_handlers(obj); - if (obj->error) { - obj->error(obj->opaque, 0); + async_read_clear_handlers(async); + if (async->error) { + async->error(async->opaque, 0); } return; } } else { - obj->now += n; - if (obj->now == obj->end) { - async_read_clear_handlers(obj); - obj->done(obj->opaque); + async->now += n; + if (async->now == async->end) { + async_read_clear_handlers(async); + async->done(async->opaque); return; } } @@ -454,15 +454,15 @@ void reds_stream_async_read(RedsStream *stream, AsyncReadDone read_done_cb, void *opaque) { - AsyncRead *obj = &stream->priv->async_read; - - g_return_if_fail(!obj->stream); - obj->stream = stream; - obj->now = data; - obj->end = obj->now + size; - obj->done = read_done_cb; - obj->opaque = opaque; - async_read_handler(0, 0, obj); + AsyncRead *async = &stream->priv->async_read; + + g_return_if_fail(!async->stream); + async->stream = stream; + async->now = data; + async->end = async->now + size; + async->done = read_done_cb; + async->opaque = opaque; + async_read_handler(0, 0, async); } |