From: Alan T. DeKok Date: Fri, 23 Sep 2022 16:29:42 +0000 (-0400) Subject: we don't need a parent for time tracking. X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=0447c11c831b05073e4cb244f948690034669d82;p=thirdparty%2Ffreeradius-server.git we don't need a parent for time tracking. --- diff --git a/src/lib/io/time_tracking.h b/src/lib/io/time_tracking.h index 952ab08e212..af9d55602eb 100644 --- a/src/lib/io/time_tracking.h +++ b/src/lib/io/time_tracking.h @@ -145,7 +145,7 @@ static inline CC_HINT(nonnull) void fr_time_tracking_init(fr_time_tracking_t *tt * @param[in] tt the time tracked entity. * @param[in] now the current time. */ -static inline CC_HINT(nonnull) void fr_time_tracking_start(fr_time_tracking_t *parent, +static inline CC_HINT(nonnull(2)) void fr_time_tracking_start(fr_time_tracking_t *parent, fr_time_tracking_t *tt, fr_time_t now) { fr_assert_msg(tt->state == FR_TIME_TRACKING_STOPPED, "Unexpected time tracking state state %i", tt->state); @@ -173,6 +173,7 @@ static inline CC_HINT(nonnull) void fr_time_tracking_push(fr_time_tracking_t *pa { fr_time_delta_t run_time; + fr_assert(tt->parent); fr_assert(parent->parent == tt->parent); fr_assert_msg(tt->state == FR_TIME_TRACKING_RUNNING, "Unexpected time tracking state state %i", tt->state); @@ -196,6 +197,8 @@ static inline CC_HINT(nonnull) void fr_time_tracking_pop(fr_time_tracking_t *tt, fr_time_delta_t run_time; fr_assert_msg(tt->state == FR_TIME_TRACKING_RUNNING, "Unexpected time tracking state state %i", tt->state); + fr_assert(tt->parent); + run_time = fr_time_sub(now, tt->last_changed); tt->last_changed = tt->parent->ended = now;