diff options
author | Vsevolod Stakhov <vsevolod@highsecure.ru> | 2018-08-15 15:33:29 +0100 |
---|---|---|
committer | Vsevolod Stakhov <vsevolod@highsecure.ru> | 2018-08-15 15:33:29 +0100 |
commit | 5766eb4b96808e998f19f13a3db242fec070f51b (patch) | |
tree | add81b476d1c0fffcd6076790008fb7f2cf831c3 /src/libserver/events.c | |
parent | f01c0800f7a9caf1b2b4e9c58b044d5def09e76a (diff) | |
download | rspamd-5766eb4b96808e998f19f13a3db242fec070f51b.tar.gz rspamd-5766eb4b96808e998f19f13a3db242fec070f51b.zip |
[Minor] Slightly refactor set iteration
Diffstat (limited to 'src/libserver/events.c')
-rw-r--r-- | src/libserver/events.c | 8 |
1 files changed, 2 insertions, 6 deletions
diff --git a/src/libserver/events.c b/src/libserver/events.c index bff35351f..c23c90328 100644 --- a/src/libserver/events.c +++ b/src/libserver/events.c @@ -309,17 +309,13 @@ void rspamd_session_cleanup (struct rspamd_async_session *session) { struct rspamd_async_event *ev; - int i; if (session == NULL) { msg_err ("session is NULL"); return; } - for (i = kh_begin (session->events); i != kh_end (session->events); i ++) { - if (!kh_exist (session->events, i)) continue; - ev = kh_key (session->events, i); - + kh_foreach_key (session->events, ev, { /* Call event's finalizer */ msg_debug_session ("removed event on destroy: %p, subsystem: %s", ev->user_data, @@ -328,7 +324,7 @@ rspamd_session_cleanup (struct rspamd_async_session *session) if (ev->fin != NULL) { ev->fin (ev->user_data); } - } + }); kh_clear (rspamd_events_hash, session->events); } |