From: Vsevolod Stakhov Date: Mon, 27 Dec 2021 21:05:35 +0000 (+0000) Subject: [Minor] Refactor argument/member name for better soundness X-Git-Tag: 3.2~135 X-Git-Url: https://source.dussan.org/?a=commitdiff_plain;h=160184d857561076e22fe7de1a685804e44f75a0;p=rspamd.git [Minor] Refactor argument/member name for better soundness --- diff --git a/src/libserver/async_session.c b/src/libserver/async_session.c index f84b8aa5e..2f084687b 100644 --- a/src/libserver/async_session.c +++ b/src/libserver/async_session.c @@ -50,7 +50,7 @@ static struct rspamd_counter_data events_count; struct rspamd_async_event { const gchar *subsystem; - const gchar *loc; + const gchar *event_source; event_finalizer_t fin; void *user_data; }; @@ -151,7 +151,7 @@ rspamd_session_add_event_full (struct rspamd_async_session *session, event_finalizer_t fin, gpointer user_data, const gchar *subsystem, - const gchar *loc) + const gchar *event_source) { struct rspamd_async_event *new_event; gint ret; @@ -174,14 +174,14 @@ rspamd_session_add_event_full (struct rspamd_async_session *session, new_event->fin = fin; new_event->user_data = user_data; new_event->subsystem = subsystem; - new_event->loc = loc; + new_event->event_source = event_source; msg_debug_session ("added event: %p, pending %d (+1) events, " "subsystem: %s (%s)", user_data, kh_size (session->events), subsystem, - loc); + event_source); kh_put (rspamd_events_hash, session->events, new_event, &ret); g_assert (ret > 0); @@ -193,7 +193,7 @@ void rspamd_session_remove_event_full (struct rspamd_async_session *session, event_finalizer_t fin, void *ud, - const gchar *loc) + const gchar *event_source) { struct rspamd_async_event search_ev, *found_ev; khiter_t k; @@ -215,11 +215,11 @@ rspamd_session_remove_event_full (struct rspamd_async_session *session, if (k == kh_end (session->events)) { gchar t; - msg_err_session ("cannot find event: %p(%p) from %s", fin, ud, loc); + msg_err_session ("cannot find event: %p(%p) from %s", fin, ud, event_source); kh_foreach (session->events, found_ev, t, { msg_err_session ("existing event %s (%s): %p(%p)", found_ev->subsystem, - found_ev->loc, + found_ev->event_source, found_ev->fin, found_ev->user_data); }); @@ -235,8 +235,8 @@ rspamd_session_remove_event_full (struct rspamd_async_session *session, ud, kh_size (session->events), found_ev->subsystem, - loc, - found_ev->loc); + event_source, + found_ev->event_source); kh_del (rspamd_events_hash, session->events, k); /* Remove event */ @@ -289,7 +289,7 @@ rspamd_session_cleanup (struct rspamd_async_session *session, bool forced_cleanu msg_info_session ("forced removed event on destroy: %p, subsystem: %s, scheduled from: %s", ev->user_data, ev->subsystem, - ev->loc); + ev->event_source); } else { msg_debug_session("removed event on destroy: %p, subsystem: %s", @@ -304,7 +304,7 @@ rspamd_session_cleanup (struct rspamd_async_session *session, bool forced_cleanu "%p, subsystem: %s, scheduled from: %s", ev->user_data, ev->subsystem, - ev->loc); + ev->event_source); } else { msg_debug_session("NOT removed event on destroy - uncancellable: %p, subsystem: %s", diff --git a/src/libserver/async_session.h b/src/libserver/async_session.h index 5dc4a3b84..b5323b1df 100644 --- a/src/libserver/async_session.h +++ b/src/libserver/async_session.h @@ -55,7 +55,7 @@ rspamd_session_add_event_full (struct rspamd_async_session *session, event_finalizer_t fin, gpointer user_data, const gchar *subsystem, - const gchar *loc); + const gchar *event_source); #define rspamd_session_add_event(session, fin, user_data, subsystem) \ rspamd_session_add_event_full(session, fin, user_data, subsystem, G_STRLOC) @@ -69,7 +69,7 @@ rspamd_session_add_event_full (struct rspamd_async_session *session, void rspamd_session_remove_event_full (struct rspamd_async_session *session, event_finalizer_t fin, gpointer ud, - const gchar *loc); + const gchar *event_source); #define rspamd_session_remove_event(session, fin, user_data) \ rspamd_session_remove_event_full(session, fin, user_data, G_STRLOC)