aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--contrib/libucl/khash.h8
-rw-r--r--src/libserver/events.c5
2 files changed, 9 insertions, 4 deletions
diff --git a/contrib/libucl/khash.h b/contrib/libucl/khash.h
index a91db5b2a..3e580011d 100644
--- a/contrib/libucl/khash.h
+++ b/contrib/libucl/khash.h
@@ -583,6 +583,14 @@ static kh_inline khint_t __ac_Wang_hash(khint_t key)
code; \
} }
+#define kh_foreach_key(h, kvar, code) { \
+ khint_t __i; \
+ for (__i = kh_begin(h); __i != kh_end(h); ++__i) { \
+ if (!kh_exist(h,__i)) continue; \
+ (kvar) = kh_key(h,__i); \
+ code; \
+ } }
+
/* More conenient interfaces */
/*! @function
diff --git a/src/libserver/events.c b/src/libserver/events.c
index f62005b96..c23c90328 100644
--- a/src/libserver/events.c
+++ b/src/libserver/events.c
@@ -309,14 +309,13 @@ void
rspamd_session_cleanup (struct rspamd_async_session *session)
{
struct rspamd_async_event *ev;
- gchar t;
if (session == NULL) {
msg_err ("session is NULL");
return;
}
- kh_foreach (session->events, ev, t, {
+ kh_foreach_key (session->events, ev, {
/* Call event's finalizer */
msg_debug_session ("removed event on destroy: %p, subsystem: %s",
ev->user_data,
@@ -327,8 +326,6 @@ rspamd_session_cleanup (struct rspamd_async_session *session)
}
});
- (void)t;
-
kh_clear (rspamd_events_hash, session->events);
}