Re: Patch to remove redundant code



Sven Neumann <sven gimp org> writes:

> Hi,
> 
> "Padraig O'Briain" <Padraig Obriain Sun COM> writes:
> 
> > I noticed a couple of redundant lines in gtk_widget_send_expose().
> > 
> > Permission to commit?
> > 
> > Padraig
> > Index: gtkwidget.c
> > ===================================================================
> > RCS file: /cvs/gnome/gtk+/gtk/gtkwidget.c,v
> > retrieving revision 1.293
> > diff -u -p -r1.293 gtkwidget.c
> > --- gtkwidget.c	2002/01/30 03:32:13	1.293
> > +++ gtkwidget.c	2002/01/31 08:55:42
> > @@ -2959,9 +2959,6 @@ gtk_widget_send_expose (GtkWidget *widge
> >    g_return_val_if_fail (event != NULL, TRUE);
> >    g_return_val_if_fail (event->type == GDK_EXPOSE, TRUE);
> >  
> > -  if (event->type != GDK_EXPOSE)
> > -    return TRUE;
> > -  
> >    return gtk_widget_event_internal (widget, event);
> >  }
> >  
> 
> not sure if this counts as redundant code. If GTK+ is compiled with
> G_DISABLE_CHECKS the g_return_if_fail() statements go away and you'll
> end up without a check for event->type. Calling gtk_widget_send_expose()
> with event->type != GDK_EXPOSE is a programming error however so you
> could argue that we don't need to do the check.

Exactly. It's a bit of extra paranoia. We frequently don't do it, but
I don't think it's worth removing it here.

Regards,
                                        Owen



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