diff --git a/daemon/ice.c b/daemon/ice.c index 81b2ff78b..4559e304e 100644 --- a/daemon/ice.c +++ b/daemon/ice.c @@ -260,7 +260,7 @@ static void __new_stun_transaction(struct ice_candidate_pair *pair) { /* agent must be locked */ static void __all_pairs_list(struct ice_agent *ag) { t_queue_clear(&ag->all_pairs_list); - g_tree_get_values(&ag->all_pairs_list.q, ag->all_pairs); + rtpe_g_tree_get_values(&ag->all_pairs_list.q, ag->all_pairs); } static void __tree_coll_callback(void *oo, void *nn) { @@ -292,7 +292,7 @@ static struct ice_candidate_pair *__pair_candidate(stream_fd *sfd, struct ice_ag t_queue_push_tail(&ag->candidate_pairs, pair); t_hash_table_insert(ag->pair_hash, pair, pair); - g_tree_insert_coll(ag->all_pairs, pair, pair, __tree_coll_callback); + rtpe_g_tree_insert_coll(ag->all_pairs, pair, pair, __tree_coll_callback); ilogs(ice, LOG_DEBUG, "Created candidate pair "PAIR_FORMAT" between %s and %s%s%s, type %s", PAIR_FMT(pair), sockaddr_print_buf(&sfd->socket.local.address), @@ -775,10 +775,10 @@ static int __component_find(const void *a, const void *b) { return FALSE; } static struct ice_candidate_pair *__get_pair_by_component(GTree *t, unsigned int component) { - return g_tree_find_first(t, __component_find, GUINT_TO_POINTER(component)); + return rtpe_g_tree_find_first(t, __component_find, GUINT_TO_POINTER(component)); } static void __get_pairs_by_component(candidate_pair_q *out, GTree *t, unsigned int component) { - g_tree_find_all(&out->q, t, __component_find, GUINT_TO_POINTER(component)); + rtpe_g_tree_find_all(&out->q, t, __component_find, GUINT_TO_POINTER(component)); } static void __get_complete_succeeded_pairs(candidate_pair_q *out, struct ice_agent *ag) { @@ -1063,10 +1063,10 @@ static void __recalc_pair_prios(struct ice_agent *ag) { ilogs(ice, LOG_DEBUG, "Recalculating all ICE pair priorities"); - g_tree_find_remove_all(&nominated, ag->nominated_pairs); - g_tree_find_remove_all(&succ, ag->succeeded_pairs); - g_tree_find_remove_all(&valid, ag->valid_pairs); - g_tree_find_remove_all(&all, ag->all_pairs); + rtpe_g_tree_find_remove_all(&nominated, ag->nominated_pairs); + rtpe_g_tree_find_remove_all(&succ, ag->succeeded_pairs); + rtpe_g_tree_find_remove_all(&valid, ag->valid_pairs); + rtpe_g_tree_find_remove_all(&all, ag->all_pairs); for (__auto_type l = ag->candidate_pairs.head; l; l = l->next) { pair = l->data; @@ -1075,10 +1075,10 @@ static void __recalc_pair_prios(struct ice_agent *ag) { __new_stun_transaction(pair); } - g_tree_add_all(ag->nominated_pairs, &nominated, __tree_coll_callback); - g_tree_add_all(ag->succeeded_pairs, &succ, __tree_coll_callback); - g_tree_add_all(ag->valid_pairs, &valid, __tree_coll_callback); - g_tree_add_all(ag->all_pairs, &all, __tree_coll_callback); + rtpe_g_tree_add_all(ag->nominated_pairs, &nominated, __tree_coll_callback); + rtpe_g_tree_add_all(ag->succeeded_pairs, &succ, __tree_coll_callback); + rtpe_g_tree_add_all(ag->valid_pairs, &valid, __tree_coll_callback); + rtpe_g_tree_add_all(ag->all_pairs, &all, __tree_coll_callback); __all_pairs_list(ag); } @@ -1291,11 +1291,11 @@ int ice_request(stream_fd *sfd, const endpoint_t *src, LOCK(&ag->lock); // coverity[use : FALSE] - g_tree_insert_coll(ag->nominated_pairs, pair, pair, __tree_coll_callback); + rtpe_g_tree_insert_coll(ag->nominated_pairs, pair, pair, __tree_coll_callback); if (PAIR_ISSET(pair, SUCCEEDED)) { PAIR_SET(pair, VALID); - g_tree_insert_coll(ag->valid_pairs, pair, pair, __tree_coll_callback); + rtpe_g_tree_insert_coll(ag->valid_pairs, pair, pair, __tree_coll_callback); } if (!AGENT_ISSET(ag, CONTROLLING)) @@ -1401,7 +1401,7 @@ int ice_response(stream_fd *sfd, const endpoint_t *src, if (pair->was_nominated && PAIR_CLEAR(pair, TO_USE)) { ilogs(ice, LOG_DEBUG, "Setting nominated ICE candidate pair "PAIR_FORMAT" as valid", PAIR_FMT(pair)); PAIR_SET(pair, VALID); - g_tree_insert_coll(ag->valid_pairs, pair, pair, __tree_coll_callback); + rtpe_g_tree_insert_coll(ag->valid_pairs, pair, pair, __tree_coll_callback); ret = __check_valid(ag); goto out; } @@ -1410,7 +1410,7 @@ int ice_response(stream_fd *sfd, const endpoint_t *src, goto out; ilogs(ice, LOG_DEBUG, "Setting ICE candidate pair "PAIR_FORMAT" as succeeded", PAIR_FMT(pair)); - g_tree_insert_coll(ag->succeeded_pairs, pair, pair, __tree_coll_callback); + rtpe_g_tree_insert_coll(ag->succeeded_pairs, pair, pair, __tree_coll_callback); if (!ag->start_nominating.tv_sec) { if (__check_succeeded_complete(ag)) { @@ -1442,7 +1442,7 @@ int ice_response(stream_fd *sfd, const endpoint_t *src, /* if this was previously nominated by the peer, it's now valid */ if (PAIR_ISSET(pair, NOMINATED)) { PAIR_SET(pair, VALID); - g_tree_insert_coll(ag->valid_pairs, pair, pair, __tree_coll_callback); + rtpe_g_tree_insert_coll(ag->valid_pairs, pair, pair, __tree_coll_callback); } ret = __check_valid(ag); diff --git a/daemon/timerthread.c b/daemon/timerthread.c index 6cf4aee78..72934f01b 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 = g_tree_find_first(tt->tree, NULL, NULL); + tt_obj = rtpe_g_tree_find_first(tt->tree, NULL, NULL); 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 = g_tree_find_first(ttq->entries, NULL, NULL); + struct timerthread_queue_entry *ttqe = rtpe_g_tree_find_first(ttq->entries, NULL, NULL); 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 = g_tree_find_first(ttq->entries, NULL, NULL); + struct timerthread_queue_entry *first_ttqe = rtpe_g_tree_find_first(ttq->entries, NULL, NULL); mutex_unlock(&ttq->lock); // first packet in? we're probably not scheduled yet @@ -344,7 +344,7 @@ unsigned int timerthread_queue_flush(struct timerthread_queue *ttq, void *ptr) { unsigned int num = 0; GQueue matches = G_QUEUE_INIT; - g_tree_find_all(&matches, ttq->entries, ttqe_ptr_match, ptr); + rtpe_g_tree_find_all(&matches, ttq->entries, ttqe_ptr_match, ptr); while (matches.length) { struct timerthread_queue_entry *ttqe = g_queue_pop_head(&matches); @@ -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 = g_tree_find_first(ttq->entries, NULL, NULL); + struct timerthread_queue_entry *ttqe = rtpe_g_tree_find_first(ttq->entries, NULL, NULL); assert(ttqe != NULL); g_tree_remove(ttq->entries, ttqe); diff --git a/lib/auxlib.h b/lib/auxlib.h index 16222568a..181603795 100644 --- a/lib/auxlib.h +++ b/lib/auxlib.h @@ -423,7 +423,7 @@ struct rtpe_g_tree_find_helper { }; }; -INLINE void *g_tree_find_first(GTree *t, GEqualFunc f, void *data) { +INLINE void *rtpe_g_tree_find_first(GTree *t, GEqualFunc f, void *data) { struct rtpe_g_tree_find_helper h = { .func = f, .data = data, @@ -431,7 +431,7 @@ INLINE void *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 g_tree_find_all(GQueue *out, GTree *t, GEqualFunc f, void *data) { +INLINE void rtpe_g_tree_find_all(GQueue *out, GTree *t, GEqualFunc f, void *data) { struct rtpe_g_tree_find_helper h = { .func = f, .data = data, @@ -439,26 +439,26 @@ INLINE void g_tree_find_all(GQueue *out, GTree *t, GEqualFunc f, void *data) { }; g_tree_foreach(t, rtpe_tree_find_all_cmp, &h); } -INLINE void g_tree_get_values(GQueue *out, GTree *t) { - g_tree_find_all(out, t, NULL, NULL); +INLINE void rtpe_g_tree_get_values(GQueue *out, GTree *t) { + rtpe_g_tree_find_all(out, t, NULL, NULL); } -INLINE void g_tree_find_remove_all(GQueue *out, GTree *t) { +INLINE void rtpe_g_tree_find_remove_all(GQueue *out, GTree *t) { GList *l; g_queue_init(out); - g_tree_find_all(out, t, NULL, NULL); + rtpe_g_tree_find_all(out, t, NULL, NULL); for (l = out->head; l; l = l->next) g_tree_remove(t, l->data); } -INLINE void g_tree_insert_coll(GTree *t, gpointer key, gpointer val, void (*cb)(gpointer, gpointer)) { +INLINE void rtpe_g_tree_insert_coll(GTree *t, gpointer key, gpointer val, void (*cb)(gpointer, gpointer)) { gpointer old = g_tree_lookup(t, key); if (old) cb(old, val); g_tree_insert(t, key, val); } -INLINE void g_tree_add_all(GTree *t, GQueue *q, void (*cb)(gpointer, gpointer)) { +INLINE void rtpe_g_tree_add_all(GTree *t, GQueue *q, void (*cb)(gpointer, gpointer)) { GList *l; for (l = q->head; l; l = l->next) - g_tree_insert_coll(t, l->data, l->data, cb); + rtpe_g_tree_insert_coll(t, l->data, l->data, cb); g_queue_clear(q); } diff --git a/perf-tester/main.c b/perf-tester/main.c index 055e140a0..3778a2403 100644 --- a/perf-tester/main.c +++ b/perf-tester/main.c @@ -1384,7 +1384,7 @@ static int other_threads_collect(const bool do_output, int starty, int maxy, int if (do_output) { // output based on sorted list GQueue threads = G_QUEUE_INIT; - g_tree_get_values(&threads, tree); + rtpe_g_tree_get_values(&threads, tree); int width; bar_grid(threads.length, maxx, &height, &width); diff --git a/recording-daemon/notify.c b/recording-daemon/notify.c index 15da5a48b..2dd201f42 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 = g_tree_find_first(notify_timers, NULL, NULL); + struct notif_req *first = rtpe_g_tree_find_first(notify_timers, NULL, NULL); if (!first) { ilog(LOG_DEBUG, "No scheduled HTTP notification retries, sleeping"); pthread_cond_wait(&timer_cond, &timer_lock);