From 2de873507e4eac3082323363878b4b26a9bc8ccf Mon Sep 17 00:00:00 2001
From: Marko Lindqvist <cazfi74@gmail.com>
Date: Sat, 4 May 2024 16:43:50 +0300
Subject: [PATCH 70/70] timing.c: Replace parameter checking fc_asserts with
 nonnull attributes

See RM #468

Signed-off-by: Marko Lindqvist <cazfi74@gmail.com>
---
 utility/timing.c |  9 ---------
 utility/timing.h | 19 ++++++++++++-------
 2 files changed, 12 insertions(+), 16 deletions(-)

diff --git a/utility/timing.c b/utility/timing.c
index f88aa1226c..3d629e8082 100644
--- a/utility/timing.c
+++ b/utility/timing.c
@@ -251,7 +251,6 @@ bool timer_in_use(struct timer *t)
 ***********************************************************************/
 void timer_clear(struct timer *t)
 {
-  fc_assert_ret(t != nullptr);
   t->state = TIMER_STOPPED;
   t->sec = 0.0;
   t->usec = 0;
@@ -263,8 +262,6 @@ void timer_clear(struct timer *t)
 ***********************************************************************/
 void timer_start(struct timer *t)
 {
-  fc_assert_ret(t != nullptr);
-
   if (t->use == TIMER_IGNORE) {
     return;
   }
@@ -307,8 +304,6 @@ void timer_start(struct timer *t)
 ***********************************************************************/
 void timer_stop(struct timer *t)
 {
-  fc_assert_ret(t != nullptr);
-
   if (t->use == TIMER_IGNORE) {
     return;
   }
@@ -383,8 +378,6 @@ void timer_stop(struct timer *t)
 ***********************************************************************/
 double timer_read_seconds(struct timer *t)
 {
-  fc_assert_ret_val(t != nullptr, -1.0);
-
   if (t->use == TIMER_IGNORE) {
     return 0.0;
   }
@@ -410,8 +403,6 @@ void timer_usleep_since_start(struct timer *t, long usec)
   long elapsed_usec;
   long wait_usec;
 
-  fc_assert_ret(t != nullptr);
-
   ret = gettimeofday(&tv_now, nullptr);
 
   if ((ret == -1)
diff --git a/utility/timing.h b/utility/timing.h
index d1eb00da97..e9fcf0ecaa 100644
--- a/utility/timing.h
+++ b/utility/timing.h
@@ -79,13 +79,18 @@ struct timer *timer_renew(struct timer *t, enum timer_timetype type,
 void timer_destroy(struct timer *t);
 bool timer_in_use(struct timer *t);
 
-void timer_clear(struct timer *t);
-void timer_start(struct timer *t);
-void timer_stop(struct timer *t);
-
-double timer_read_seconds(struct timer *t);
-
-void timer_usleep_since_start(struct timer *t, long usec);
+void timer_clear(struct timer *t)
+  fc__attribute((nonnull (1)));
+void timer_start(struct timer *t)
+  fc__attribute((nonnull (1)));
+void timer_stop(struct timer *t)
+  fc__attribute((nonnull (1)));
+
+double timer_read_seconds(struct timer *t)
+  fc__attribute((nonnull (1)));
+
+void timer_usleep_since_start(struct timer *t, long usec)
+  fc__attribute((nonnull (1)));
 
 #ifdef __cplusplus
 }
-- 
2.43.0

