gstinfo: Simplify gst_debug_reset_threshold() implementation

Replace the while+goto with a for+break and check walk to determine
whether we had a match. Move up the unlock to keep the locked section as
small as possible.

https://bugzilla.gnome.org/show_bug.cgi?id=794717
This commit is contained in:
Jan Alexander Steffens (heftig) 2018-03-27 10:15:46 +02:00 committed by Tim-Philipp Müller
parent b12df466f2
commit c4ff069864

View file

@ -1598,18 +1598,16 @@ gst_debug_reset_threshold (gpointer category, gpointer unused)
GSList *walk;
g_mutex_lock (&__level_name_mutex);
walk = __level_name;
while (walk) {
LevelNameEntry *entry = walk->data;
walk = g_slist_next (walk);
if (gst_debug_apply_entry (cat, entry))
goto exit;
for (walk = __level_name; walk != NULL; walk = walk->next) {
if (gst_debug_apply_entry (cat, walk->data))
break;
}
gst_debug_category_set_threshold (cat, gst_debug_get_default_threshold ());
exit:
g_mutex_unlock (&__level_name_mutex);
if (walk == NULL)
gst_debug_category_set_threshold (cat, gst_debug_get_default_threshold ());
}
static void