Re: [PATCH] gtktextchild.c: CHECK_IN_BUFFER_RETURN



Daniel Elstner <daniel elstner gmx net> writes:

> Hi,
> 
> huge one-line macros are ugly, aren't they? ;)
> This one returns always:
> 
> #define CHECK_IN_BUFFER_RETURN(anchor, val) do { if ((anchor)->segment
> == NULL) g_warning ("%s: GtkTextChildAnchor hasn't
>  been in a buffer yet", G_GNUC_FUNCTION); return (val); } while (0)
> 
> Patch attached, OK to commit?

If we are changing this, why not make it legible as well:

#define CHECK_IN_BUFFER_RETURN(anchor, val)						  \
  G_STMT_START {									  \
   if ((anchor)->segment == NULL)							  \
     {											  \
       g_warning ("%s: GtkTextChildAnchor hasn't been in a buffer yet", G_GNUC_FUNCTION); \
       return (val);									  \
     }											  \
  } G_STMT_END

Regards,
                                        Owen

> ? prop_tag_table.diff
> Index: ChangeLog
> ===================================================================
> RCS file: /cvs/gnome/gtk+/ChangeLog,v
> retrieving revision 1.2976
> diff -u -3 -r1.2976 ChangeLog
> --- ChangeLog	2002/02/09 13:04:51	1.2976
> +++ ChangeLog	2002/02/09 18:22:24
> @@ -1,3 +1,8 @@
> +2002-02-09  Daniel Elstner  <daniel elstner gmx net>
> +
> +	* gtk/gtktextchild.c (CHECK_IN_BUFFER_RETURN): Add missing
> +	curled braces so that it doesn't always return.
> +
>  Sat Feb  9 13:58:41 2002  Soeren Sandmann  <sandmann daimi au dk>
>  
>  	* gtk/gtkpaned.[ch]: Keyboard navigation for GtkPaned
> Index: gtk/gtktextchild.c
> ===================================================================
> RCS file: /cvs/gnome/gtk+/gtk/gtktextchild.c,v
> retrieving revision 1.18
> diff -u -3 -r1.18 gtktextchild.c
> --- gtk/gtktextchild.c	2002/02/08 16:23:05	1.18
> +++ gtk/gtktextchild.c	2002/02/09 18:22:26
> @@ -53,7 +53,7 @@
>  #include "gtktextlayout.h"
>  
>  #define CHECK_IN_BUFFER(anchor) do { if ((anchor)->segment == NULL) g_warning ("%s: GtkTextChildAnchor hasn't been in a buffer yet", G_GNUC_FUNCTION); } while (0)
> -#define CHECK_IN_BUFFER_RETURN(anchor, val) do { if ((anchor)->segment == NULL) g_warning ("%s: GtkTextChildAnchor hasn't been in a buffer yet", G_GNUC_FUNCTION); return (val); } while (0)
> +#define CHECK_IN_BUFFER_RETURN(anchor, val) do { if ((anchor)->segment == NULL) { g_warning ("%s: GtkTextChildAnchor hasn't been in a buffer yet", G_GNUC_FUNCTION); return (val); } } while (0)
>  
>  static GtkTextLineSegment *
>  pixbuf_segment_cleanup_func (GtkTextLineSegment *seg,




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