diff options
author | Marc-André Lureau <marcandre.lureau@redhat.com> | 2011-01-20 04:11:41 +0100 |
---|---|---|
committer | Marc-André Lureau <marcandre.lureau@redhat.com> | 2011-01-20 04:14:35 +0100 |
commit | 5031abd6020a5f73261ed484afb26ea5bbae3215 (patch) | |
tree | cf35e2feccf6d1b6297b80c51d7d49cc05247ab2 | |
parent | d831dc394d35455fd9d2cac8942bd45162e8d504 (diff) |
gtk: cosmetic, make it look safer session_channel_destroy()
Although not necessary, this loop rewrite is easier to read, to see
that the function is safe: the function returns when removing the
item, so it was safe before but as well...
-rw-r--r-- | gtk/spice-session.c | 5 |
1 files changed, 3 insertions, 2 deletions
diff --git a/gtk/spice-session.c b/gtk/spice-session.c index c6df211..800185b 100644 --- a/gtk/spice-session.c +++ b/gtk/spice-session.c @@ -697,13 +697,14 @@ void spice_session_channel_destroy(SpiceSession *session, SpiceChannel *channel) { spice_session *s = SPICE_SESSION_GET_PRIVATE(session); struct channel *item = NULL; - RingItem *ring; + RingItem *ring, *next; g_return_if_fail(s != NULL); g_return_if_fail(channel != NULL); for (ring = ring_get_head(&s->channels); ring != NULL; - ring = ring_next(&s->channels, ring)) { + ring = next) { + next = ring_next(&s->channels, ring); item = SPICE_CONTAINEROF(ring, struct channel, link); if (item->channel == channel) { ring_remove(&item->link); |