diff options
author | Ryan Lortie <desrt@desrt.ca> | 2014-02-13 16:58:34 -0500 |
---|---|---|
committer | Ryan Lortie <desrt@desrt.ca> | 2014-02-15 16:57:12 -0500 |
commit | 16b4604d9381e15c375b7b69f4731fafe32c6b15 (patch) | |
tree | adfc1e41165d1726feb463f517b0f4fe11650ae6 | |
parent | 8c4dc84173190bd10e1a2de77524869b3da672e5 (diff) | |
download | glib-16b4604d9381e15c375b7b69f4731fafe32c6b15.tar.gz |
gsocket: don't abuse GPollFD.revents field
We are reusing the GPollFD.revents field of the source to store a
temporary value. Use a local variable for that instead.
This is a refactor to make the next commit easier to understand.
-rw-r--r-- | gio/gsocket.c | 9 |
1 files changed, 5 insertions, 4 deletions
diff --git a/gio/gsocket.c b/gio/gsocket.c index bbc1b5713..7c431c9f3 100644 --- a/gio/gsocket.c +++ b/gio/gsocket.c @@ -3259,17 +3259,18 @@ socket_source_dispatch (GSource *source, GSocketSourceFunc func = (GSocketSourceFunc)callback; GSocketSource *socket_source = (GSocketSource *)source; GSocket *socket = socket_source->socket; + guint events; gboolean ret; #ifdef G_OS_WIN32 - socket_source->pollfd.revents = update_condition (socket_source->socket); + events = update_condition (socket_source->socket); +#else + events = socket_source->pollfd.revents; #endif if (socket_source->socket->priv->timed_out) socket_source->pollfd.revents |= socket_source->condition & (G_IO_IN | G_IO_OUT); - ret = (*func) (socket, - socket_source->pollfd.revents & socket_source->condition, - user_data); + ret = (*func) (socket, events & socket_source->condition, user_data); if (socket->priv->timeout) socket_source->timeout_time = g_get_monotonic_time () + |