Re: RFC: warnings on ignoring return value on some list operations



On Thu, 2005-12-01 at 18:40 +0100, Alexander Larsson wrote:
> On Thu, 2005-12-01 at 12:39 +0100, Tim Janik wrote:
> 
> > and there were no strong objections after that. so it'd be nice if you provided
> > a patch that covered all list functions. i think that can get commit approval
> > right away then.
> 
> What about this one.
> 

So, Owen asked about the effect of this on the GTK+ code base, so I
tried it, and got 3 warnings from compiling all of Pango and GTK+
against Alex' patch.

pango-attributes.c:1075 Append to a known non-empty list
gtkclist.c:2848 Removal from a temp list pointer which is not used 
                afterwards
gtkstyle.c:621 Removal of a list element thats known to not be the first

All three places can easily be fixed.


Matthias
Index: pango/pango-attributes.c
===================================================================
RCS file: /cvs/gnome/pango/pango/pango-attributes.c,v
retrieving revision 1.55
diff -u -p -r1.55 pango-attributes.c
--- pango/pango-attributes.c	23 Nov 2005 17:54:54 -0000	1.55
+++ pango/pango-attributes.c	4 Dec 2005 05:50:42 -0000
@@ -1072,7 +1072,7 @@ pango_attr_list_insert_internal (PangoAt
   else if (((PangoAttribute *)list->attributes_tail->data)->start_index < start_index ||
 	   (!before && ((PangoAttribute *)list->attributes_tail->data)->start_index == start_index))
     {
-      g_slist_append (list->attributes_tail, attr);
+      list->attributes_tail = g_slist_append (list->attributes_tail, attr);
       list->attributes_tail = list->attributes_tail->next;
       g_assert (list->attributes_tail);
     }
Index: gtk/gtkclist.c
===================================================================
RCS file: /cvs/gnome/gtk+/gtk/gtkclist.c,v
retrieving revision 1.238
diff -u -p -r1.238 gtkclist.c
--- gtk/gtkclist.c	23 Nov 2005 18:06:56 -0000	1.238
+++ gtk/gtkclist.c	4 Dec 2005 05:52:10 -0000
@@ -2845,7 +2845,7 @@ real_remove_row (GtkCList *clist,
     clist->row_list = g_list_next (list);
   if (clist->row_list_end == list)
     clist->row_list_end = g_list_previous (list);
-  g_list_remove (list, clist_row);
+  list = g_list_remove (list, clist_row);
 
   if (row < ROW_FROM_YPIXEL (clist, 0))
     clist->voffset += clist->row_height + CELL_SPACING;
Index: gtk/gtkstyle.c
===================================================================
RCS file: /cvs/gnome/gtk+/gtk/gtkstyle.c,v
retrieving revision 1.187
diff -u -p -r1.187 gtkstyle.c
--- gtk/gtkstyle.c	23 Nov 2005 10:33:57 -0000	1.187
+++ gtk/gtkstyle.c	4 Dec 2005 05:52:28 -0000
@@ -618,7 +618,7 @@ gtk_style_finalize (GObject *object)
   if (style->styles)
     {
       if (style->styles->data != style)
-        g_slist_remove (style->styles, style);
+        style->styles = g_slist_remove (style->styles, style);
       else
         {
           GSList *tmp_list = style->styles->next;


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