/* also regenerates all_pairs_list */ static void __recalc_pair_prios(struct ice_agent *ag) { struct ice_candidate_pair *pair; GList *l; GQueue nominated, valid, succ, all; ilog(LOG_DEBUG, "Recalculating all ICE pair priorities"); g_tree_remove_all(&nominated, ag->nominated_pairs); g_tree_remove_all(&succ, ag->succeeded_pairs); g_tree_remove_all(&valid, ag->valid_pairs); g_tree_remove_all(&all, ag->all_pairs); for (l = ag->candidate_pairs.head; l; l = l->next) { pair = l->data; __do_ice_pair_priority(pair); /* this changes the packets, so we must keep these from being seen as retransmits */ __new_stun_transaction(pair); } g_tree_add_all(ag->nominated_pairs, &nominated); g_tree_add_all(ag->succeeded_pairs, &succ); g_tree_add_all(ag->valid_pairs, &valid); g_tree_add_all(ag->all_pairs, &all); __all_pairs_list(ag); }
/** * g_tree_destroy: * @tree: a #GTree * * Removes all keys and values from the #GTree and decreases its * reference count by one. If keys and/or values are dynamically * allocated, you should either free them first or create the #GTree * using g_tree_new_full(). In the latter case the destroy functions * you supplied will be called on all keys and values before destroying * the #GTree. */ void g_tree_destroy (GTree *tree) { g_return_if_fail (tree != NULL); g_tree_remove_all (tree); g_tree_unref (tree); }
/** * g_tree_unref: * @tree: a #GTree * * Decrements the reference count of @tree by one. * If the reference count drops to 0, all keys and values will * be destroyed (if destroy functions were specified) and all * memory allocated by @tree will be released. * * It is safe to call this function from any thread. * * Since: 2.22 */ void g_tree_unref (GTree *tree) { g_return_if_fail (tree != NULL); if (g_atomic_int_dec_and_test (&tree->ref_count)) { g_tree_remove_all (tree); g_slice_free (GTree, tree); } }