[glib] notify: Make dedup code clearer



commit 0483ef000ae323415bb0c7b762dd587f1384b1f3
Author: Benjamin Otte <otte redhat com>
Date:   Thu Jul 22 21:51:28 2010 +0200

    notify: Make dedup code clearer
    
    A for loops seems easier to understand to me than gotos.

 gobject/gobjectnotifyqueue.c |   17 +++++++++--------
 1 files changed, 9 insertions(+), 8 deletions(-)
---
diff --git a/gobject/gobjectnotifyqueue.c b/gobject/gobjectnotifyqueue.c
index ef1c90d..bf4d301 100644
--- a/gobject/gobjectnotifyqueue.c
+++ b/gobject/gobjectnotifyqueue.c
@@ -124,16 +124,17 @@ g_object_notify_queue_thaw (GObject            *object,
   for (slist = nqueue->pspecs; slist; slist = slist->next)
     {
       GParamSpec *pspec = slist->data;
-      guint i = 0;
+      guint i;
 
       /* dedup, make pspecs in the list unique */
-    redo_dedup_check:
-      if (pspecs[i] == pspec)
-	continue;
-      if (++i < n_pspecs)
-	goto redo_dedup_check;
-
-      pspecs[n_pspecs++] = pspec;
+      for (i = 0; i < n_pspecs; i++)
+        {
+          if (pspecs[i] == pspec)
+            break;
+        }
+
+      if (i == n_pspecs) /* if no match was found */
+        pspecs[n_pspecs++] = pspec;
     }
   g_datalist_id_set_data (&object->qdata, context->quark_notify_queue, NULL);
 



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