diff options
| author | Přemysl Janouch <p.janouch@gmail.com> | 2015-07-14 22:25:30 +0200 | 
|---|---|---|
| committer | Přemysl Janouch <p.janouch@gmail.com> | 2015-07-14 22:25:30 +0200 | 
| commit | d6a4ca14340d6618b782ec04e86281f9a1c2653e (patch) | |
| tree | e51b648742ab91cfb2813eb2215674ec66e7d098 /kike.c | |
| parent | 955552f4fac26c936d1c2951ee0f8fd214b401ef (diff) | |
| download | xK-d6a4ca14340d6618b782ec04e86281f9a1c2653e.tar.gz xK-d6a4ca14340d6618b782ec04e86281f9a1c2653e.tar.xz xK-d6a4ca14340d6618b782ec04e86281f9a1c2653e.zip | |
Bump liberty, fix map iterators
Diffstat (limited to 'kike.c')
| -rw-r--r-- | kike.c | 25 | 
1 files changed, 12 insertions, 13 deletions
| @@ -870,18 +870,18 @@ client_unregister (struct client *c, const char *reason)  	irc_send_to_roommates (c, message);  	free (message); -	struct str_map_iter iter; -	str_map_iter_init (&iter, &c->ctx->channels); -	struct channel *chan, *next = str_map_iter_next (&iter); -	for (chan = next; chan; chan = next) +	struct str_map_unset_iter iter; +	str_map_unset_iter_init (&iter, &c->ctx->channels); +	struct channel *chan; +	while ((chan = str_map_unset_iter_next (&iter)))  	{ -		next = str_map_iter_next (&iter);  		struct channel_user *user;  		if (!(user = channel_get_user (chan, c)))  			continue;  		channel_remove_user (chan, user);  		irc_channel_destroy_if_empty (c->ctx, chan);  	} +	str_map_unset_iter_free (&iter);  	client_add_to_whowas (c); @@ -2590,16 +2590,15 @@ irc_try_part (struct client *c, const char *channel_name, const char *reason)  static void  irc_part_all_channels (struct client *c)  { -	struct str_map_iter iter; -	str_map_iter_init (&iter, &c->ctx->channels); -	struct channel *chan, *next = str_map_iter_next (&iter); -	for (chan = next; chan; chan = next) -	{ -		// We have to be careful here, the channel might get destroyed -		next = str_map_iter_next (&iter); +	// We have to be careful here, the channel might get destroyed +	struct str_map_unset_iter iter; +	str_map_unset_iter_init (&iter, &c->ctx->channels); + +	struct channel *chan; +	while ((chan = str_map_unset_iter_next (&iter)))  		if (channel_get_user (chan, c))  			irc_try_part (c, chan->name, NULL); -	} +	str_map_unset_iter_free (&iter);  }  static void | 
