[gnome-media] Assert if we can't find the current profile



commit 7ffe50b9a2ae4f1a8d6d2562935cd276ae915eca
Author: Bastien Nocera <hadess hadess net>
Date:   Fri Jul 24 16:19:21 2009 +0100

    Assert if we can't find the current profile
    
    When getting the current profile, assert if it can't be
    found in the list of profiles.

 gnome-volume-control/src/gvc-mixer-card.c |   21 ++++++++++-----------
 1 files changed, 10 insertions(+), 11 deletions(-)
---
diff --git a/gnome-volume-control/src/gvc-mixer-card.c b/gnome-volume-control/src/gvc-mixer-card.c
index e9a4482..9037ff2 100644
--- a/gnome-volume-control/src/gvc-mixer-card.c
+++ b/gnome-volume-control/src/gvc-mixer-card.c
@@ -146,21 +146,20 @@ GvcMixerCardProfile *
 gvc_mixer_card_get_profile (GvcMixerCard *card)
 {
         GList *l;
-        GvcMixerCardProfile *ret;
 
         g_return_val_if_fail (GVC_IS_MIXER_CARD (card), NULL);
         g_return_val_if_fail (card->priv->profiles != NULL, FALSE);
 
-        ret = NULL;
         for (l = card->priv->profiles; l != NULL; l = l->next) {
                 GvcMixerCardProfile *p = l->data;
                 if (g_str_equal (card->priv->profile, p->profile)) {
-                        ret = p;
-                        break;
+                        return p;
                 }
         }
 
-        return ret;
+        g_assert_not_reached ();
+
+        return NULL;
 }
 
 gboolean
@@ -260,13 +259,13 @@ gvc_mixer_card_get_profiles (GvcMixerCard *card)
 
 static int
 sort_profiles (GvcMixerCardProfile *a,
-	       GvcMixerCardProfile *b)
+               GvcMixerCardProfile *b)
 {
-	if (a->priority == b->priority)
-		return 0;
-	if (a->priority > b->priority)
-		return 1;
-	return -1;
+        if (a->priority == b->priority)
+                return 0;
+        if (a->priority > b->priority)
+                return 1;
+        return -1;
 }
 
 gboolean



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]