From b7a22068ae9aee01807f981f693b561749923174 Mon Sep 17 00:00:00 2001 From: Mike Yuan Date: Fri, 1 Mar 2024 21:43:12 +0800 Subject: [PATCH] core/service: rearrange variables, use ASSERT_PTR --- src/core/service.c | 14 ++++++-------- 1 file changed, 6 insertions(+), 8 deletions(-) diff --git a/src/core/service.c b/src/core/service.c index 086404f6752..77531bbba92 100644 --- a/src/core/service.c +++ b/src/core/service.c @@ -4364,25 +4364,23 @@ static void service_notify_message( char * const *tags, FDSet *fds) { - Service *s = SERVICE(u); - bool notify_dbus = false; - usec_t monotonic_usec = USEC_INFINITY; - const char *e; + Service *s = ASSERT_PTR(SERVICE(u)); int r; - assert(u); assert(ucred); if (!service_notify_message_authorized(s, ucred->pid, fds)) return; if (DEBUG_LOGGING) { - _cleanup_free_ char *cc = NULL; - - cc = strv_join(tags, ", "); + _cleanup_free_ char *cc = strv_join(tags, ", "); log_unit_debug(u, "Got notification message from PID "PID_FMT" (%s)", ucred->pid, empty_to_na(cc)); } + usec_t monotonic_usec = USEC_INFINITY; + bool notify_dbus = false; + const char *e; + /* Interpret MAINPID= */ e = strv_find_startswith(tags, "MAINPID="); if (e && IN_SET(s->state, SERVICE_START, SERVICE_START_POST, SERVICE_RUNNING, SERVICE_RELOAD, SERVICE_RELOAD_SIGNAL, SERVICE_RELOAD_NOTIFY)) { -- 2.47.3