diff --git a/daemon/timerthread.c b/daemon/timerthread.c index 72934f01b..2226048b3 100644 --- a/daemon/timerthread.c +++ b/daemon/timerthread.c @@ -68,7 +68,7 @@ static void timerthread_run(void *p) { // find the first element if we haven't determined it yet struct timerthread_obj *tt_obj = tt->obj; if (!tt_obj) { - tt_obj = rtpe_g_tree_find_first(tt->tree, NULL, NULL); + tt_obj = rtpe_g_tree_first(tt->tree); if (!tt_obj) goto sleep_now; @@ -198,7 +198,7 @@ void timerthread_queue_run(void *ptr) { mutex_lock(&ttq->lock); while (g_tree_nnodes(ttq->entries)) { - struct timerthread_queue_entry *ttqe = rtpe_g_tree_find_first(ttq->entries, NULL, NULL); + struct timerthread_queue_entry *ttqe = rtpe_g_tree_first(ttq->entries); assert(ttqe != NULL); g_tree_remove(ttq->entries, ttqe); @@ -324,7 +324,7 @@ void timerthread_queue_push(struct timerthread_queue *ttq, struct timerthread_qu // this hands over ownership of cp, so we must copy the timeval out struct timeval tv_send = ttqe->when; g_tree_insert(ttq->entries, ttqe, ttqe); - struct timerthread_queue_entry *first_ttqe = rtpe_g_tree_find_first(ttq->entries, NULL, NULL); + struct timerthread_queue_entry *first_ttqe = rtpe_g_tree_first(ttq->entries); mutex_unlock(&ttq->lock); // first packet in? we're probably not scheduled yet @@ -366,7 +366,7 @@ void timerthread_queue_flush_data(void *ptr) { mutex_lock(&ttq->lock); while (g_tree_nnodes(ttq->entries)) { - struct timerthread_queue_entry *ttqe = rtpe_g_tree_find_first(ttq->entries, NULL, NULL); + struct timerthread_queue_entry *ttqe = rtpe_g_tree_first(ttq->entries); assert(ttqe != NULL); g_tree_remove(ttq->entries, ttqe); diff --git a/lib/auxlib.h b/lib/auxlib.h index 181603795..2c9284c1a 100644 --- a/lib/auxlib.h +++ b/lib/auxlib.h @@ -431,6 +431,9 @@ INLINE void *rtpe_g_tree_find_first(GTree *t, GEqualFunc f, void *data) { g_tree_foreach(t, rtpe_tree_find_first_cmp, &h); return h.out_p; } +INLINE void *rtpe_g_tree_first(GTree *t) { + return rtpe_g_tree_find_first(t, NULL, NULL); +} INLINE void rtpe_g_tree_find_all(GQueue *out, GTree *t, GEqualFunc f, void *data) { struct rtpe_g_tree_find_helper h = { .func = f, diff --git a/recording-daemon/notify.c b/recording-daemon/notify.c index 2dd201f42..dba575231 100644 --- a/recording-daemon/notify.c +++ b/recording-daemon/notify.c @@ -202,7 +202,7 @@ static void *notify_timer(void *p) { // grab first entry in list, check retry time, sleep if it's in the future - struct notif_req *first = rtpe_g_tree_find_first(notify_timers, NULL, NULL); + struct notif_req *first = rtpe_g_tree_first(notify_timers); if (!first) { ilog(LOG_DEBUG, "No scheduled HTTP notification retries, sleeping"); pthread_cond_wait(&timer_cond, &timer_lock);