[libhandy/wip/exalm/paginator-animate: 73/78] carousel-box: Use for loop in forall()



commit 46d8f3d32cddc8f4e4e914d2186e30a77ac277a8
Author: Alexander Mikhaylenko <alexm gnome org>
Date:   Sun Dec 29 19:29:49 2019 +0500

    carousel-box: Use for loop in forall()
    
    A small cleanup.
    
    Signed-off-by: Alexander Mikhaylenko <alexm gnome org>

 src/hdy-carousel-box.c | 14 ++++++--------
 1 file changed, 6 insertions(+), 8 deletions(-)
---
diff --git a/src/hdy-carousel-box.c b/src/hdy-carousel-box.c
index 1643f9b8..64a8eb3e 100644
--- a/src/hdy-carousel-box.c
+++ b/src/hdy-carousel-box.c
@@ -698,16 +698,14 @@ hdy_carousel_box_forall (GtkContainer *container,
                          gpointer      callback_data)
 {
   HdyCarouselBox *self = HDY_CAROUSEL_BOX (container);
-  GList *list;
-  GtkWidget *child;
+  g_autoptr (GList) children = NULL;
+  GList *l;
 
-  list = self->children;
-  while (list) {
-    HdyCarouselBoxChildInfo *child_info = list->data;
-    child = child_info->widget;
-    list = list->next;
+  children = g_list_copy (self->children);
+  for (l = children; l; l = l->next) {
+    HdyCarouselBoxChildInfo *child = l->data;
 
-    (* callback) (child, callback_data);
+    (* callback) (child->widget, callback_data);
   }
 }
 


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