Commit 8a6dea2d authored by Tim Janik's avatar Tim Janik

GLib:

        * glib_pre1.h:
        * glib_pre2.h:
        * glib.h: this file now gets concatenated by makeglib_h from
        glib_pre1.h and glib_pre2.h to merge in glibconfig.h wich got
        created by configure (done by Jay Painter).

        * glib_pre2.h: the g_assert*() and g_return_*_fail() macros
        are wrapped by G_STMT_START and G_STMT_END now, to avoid conflicts
        when used within if (...) g_macro(); else ... conditionals.
Gtk+:
        * fixed some compiler errors, because g_return_if_fail() wasn't used
        with a trailing semicolon in some places. fixed few other warnings also.

-timj
parent 68269a3f
Wed Dec 10 23:40:03 1997 Tim Janik <timj@psynet.net>
* fixed some compiler errors, because g_return_if_fail() wasn't used
with a trailing semicolon in some places. fixed few other warnings also.
Tue Dec 9 Owen Taylor <owt1@cornell.edu>
* configure changes: (configure.in, glib/configure.in)
Change test ! `...` to test -z `...`
......
Wed Dec 10 23:40:03 1997 Tim Janik <timj@psynet.net>
* fixed some compiler errors, because g_return_if_fail() wasn't used
with a trailing semicolon in some places. fixed few other warnings also.
Tue Dec 9 Owen Taylor <owt1@cornell.edu>
* configure changes: (configure.in, glib/configure.in)
Change test ! `...` to test -z `...`
......
Wed Dec 10 23:40:03 1997 Tim Janik <timj@psynet.net>
* fixed some compiler errors, because g_return_if_fail() wasn't used
with a trailing semicolon in some places. fixed few other warnings also.
Tue Dec 9 Owen Taylor <owt1@cornell.edu>
* configure changes: (configure.in, glib/configure.in)
Change test ! `...` to test -z `...`
......
Wed Dec 10 23:40:03 1997 Tim Janik <timj@psynet.net>
* fixed some compiler errors, because g_return_if_fail() wasn't used
with a trailing semicolon in some places. fixed few other warnings also.
Tue Dec 9 Owen Taylor <owt1@cornell.edu>
* configure changes: (configure.in, glib/configure.in)
Change test ! `...` to test -z `...`
......
Wed Dec 10 23:40:03 1997 Tim Janik <timj@psynet.net>
* fixed some compiler errors, because g_return_if_fail() wasn't used
with a trailing semicolon in some places. fixed few other warnings also.
Tue Dec 9 Owen Taylor <owt1@cornell.edu>
* configure changes: (configure.in, glib/configure.in)
Change test ! `...` to test -z `...`
......
Wed Dec 10 23:40:03 1997 Tim Janik <timj@psynet.net>
* fixed some compiler errors, because g_return_if_fail() wasn't used
with a trailing semicolon in some places. fixed few other warnings also.
Tue Dec 9 Owen Taylor <owt1@cornell.edu>
* configure changes: (configure.in, glib/configure.in)
Change test ! `...` to test -z `...`
......
Wed Dec 10 23:40:03 1997 Tim Janik <timj@psynet.net>
* fixed some compiler errors, because g_return_if_fail() wasn't used
with a trailing semicolon in some places. fixed few other warnings also.
Tue Dec 9 Owen Taylor <owt1@cornell.edu>
* configure changes: (configure.in, glib/configure.in)
Change test ! `...` to test -z `...`
......
......@@ -415,7 +415,7 @@ GdkWindow*
gdk_window_ref (GdkWindow *window)
{
GdkWindowPrivate *private = (GdkWindowPrivate *)window;
g_return_if_fail (window != NULL);
g_return_val_if_fail (window != NULL, NULL);
private->ref_count += 1;
return window;
......
......@@ -415,7 +415,7 @@ GdkWindow*
gdk_window_ref (GdkWindow *window)
{
GdkWindowPrivate *private = (GdkWindowPrivate *)window;
g_return_if_fail (window != NULL);
g_return_val_if_fail (window != NULL, NULL);
private->ref_count += 1;
return window;
......
Wed Dec 10 23:27:20 1997 Tim Janik <timj@psynet.net>
* glib_pre1.h:
* glib_pre2.h:
* glib.h: this file now gets concatenated by makeglib_h from
glib_pre1.h and glib_pre2.h to merge in glibconfig.h wich got
created by configure (done by Jay Painter).
* glib_pre2.h: the g_assert*() and g_return_*_fail() macros
are wrapped by G_STMT_START and G_STMT_END now, to avoid conflicts
when used within if (...) g_macro(); else ... conditionals.
Tue Dec 17 13:14:07 1996 Peter Mattis <pmattis@charnley.HIP.Berkeley.EDU>
* glib.h: Changed 'g_return_if_fail' and 'g_return_val_if_fail' to
......
......@@ -130,31 +130,57 @@
((type *) g_mem_chunk_alloc (chunk))
#define g_string(x) #x
/* Provide simple macro statement wrappers (adapted from Pearl):
* G_STMT_START { statements; } G_STMT_END;
* can be used as a single statement, as in
* if (x) G_STMT_START { ... } G_STMT_END; else ...
*
* For gcc we will wrap the statements within `({' and `})' braces.
* For SunOS they will be wrapped within `if (1)' and `else (void)0',
* and otherwise within `do' and `while (0)'.
*/
#if !(defined (G_STMT_START) && defined (G_STMT_END))
# if defined (__GNUC__) && !defined (__STRICT_ANSI__) && !defined (__cplusplus)
# define G_STMT_START (void)(
# define G_STMT_END )
# else
# if (defined (sun) || defined (__sun__))
# define G_STMT_START if (1)
# define G_STMT_END else (void)0
# else
# define G_STMT_START do
# define G_STMT_END while (0)
# endif
# endif
#endif
/* Provide macros for error handling. The "assert" macros will
* exit on failur. The "return" macros will exit the current
* exit on failure. The "return" macros will exit the current
* function. Two different definitions are given for the macros
* in order to support gcc's __PRETTY_FUNCTION__ capability.
*/
#define g_string(x) #x
#ifdef __GNUC__
#define g_assert(expr) \
#define g_assert(expr) G_STMT_START{\
if (!(expr)) \
g_error ("file %s: line %d (%s): \"%s\"", \
__FILE__, \
__LINE__, \
__PRETTY_FUNCTION__, \
#expr)
#expr); }G_STMT_END
#define g_assert_not_reached() \
#define g_assert_not_reached() G_STMT_START{ \
g_error ("file %s: line %d (%s): \"should not be reached\"", \
__FILE__, \
__LINE__, \
__PRETTY_FUNCTION__)
__PRETTY_FUNCTION__); }G_STMT_END
#define g_return_if_fail(expr) \
#define g_return_if_fail(expr) G_STMT_START{ \
if (!(expr)) \
{ \
g_warning ("file %s: line %d (%s): \"%s\"", \
......@@ -163,9 +189,9 @@
__PRETTY_FUNCTION__, \
#expr); \
return; \
}
}; }G_STMT_END
#define g_return_val_if_fail(expr,val) \
#define g_return_val_if_fail(expr,val) G_STMT_START{ \
if (!(expr)) \
{ \
g_warning ("file %s: line %d (%s): \"%s\"", \
......@@ -174,23 +200,23 @@
__PRETTY_FUNCTION__, \
#expr); \
return val; \
}
}; }G_STMT_END
#else /* __GNUC__ */
#define g_assert(expr) \
#define g_assert(expr) G_STMT_START{\
if (!(expr)) \
g_error ("file %s: line %d: \"%s\"", \
__FILE__, \
__LINE__, \
#expr)
#expr); }G_STMT_END
#define g_assert_not_reached() \
#define g_assert_not_reached() G_STMT_START{ \
g_error ("file %s: line %d: \"should not be reached\"", \
__FILE__, \
__LINE__)
__LINE__); }G_STMT_END
#define g_return_if_fail(expr) \
#define g_return_if_fail(expr) G_STMT_START{ \
if (!(expr)) \
{ \
g_warning ("file %s: line %d: \"%s\"", \
......@@ -198,9 +224,9 @@
__LINE__, \
#expr); \
return; \
}
}; }G_STMT_END
#define g_return_val_if_fail(expr, val) \
#define g_return_val_if_fail(expr, val) G_STMT_START{ \
if (!(expr)) \
{ \
g_warning ("file %s: line %d: \"%s\"", \
......@@ -208,7 +234,7 @@
__LINE__, \
#expr); \
return val; \
}
}; }G_STMT_END
#endif /* __GNUC__ */
......
......@@ -887,10 +887,9 @@ gtk_handle_current_idles ()
static void
gtk_handle_idle ()
{
GtkIdleFunction *idlef;
/* Caller must already have called gtk_handle_current_idles if
necessary */
* necessary
*/
g_assert (current_idles == NULL);
if (idle_functions)
......
......@@ -749,8 +749,7 @@ gtk_selection_request (GtkWidget *widget,
continue;
}
g_return_val_if_fail ((data.format >= 8)
&& (data.format % 8 == 0), FALSE)
g_return_val_if_fail ((data.format >= 8) && (data.format % 8 == 0), FALSE);
items = (data.length + data.format/8 - 1) / (data.format/8);
......
......@@ -476,7 +476,7 @@ gtk_text_set_point (GtkText *text,
{
g_return_if_fail (text != NULL);
g_return_if_fail (GTK_IS_TEXT (text));
g_return_if_fail (index >= 0 && index <= TEXT_LENGTH (text))
g_return_if_fail (index >= 0 && index <= TEXT_LENGTH (text));
text->point = find_mark (text, index);
}
......
......@@ -741,6 +741,7 @@ gtk_window_key_release_event (GtkWidget *widget,
g_return_val_if_fail (event != NULL, FALSE);
window = GTK_WINDOW (widget);
return_val = FALSE;
if (window->focus_widget)
return_val = gtk_widget_event (window->focus_widget, (GdkEvent*) event);
......@@ -834,7 +835,7 @@ gtk_window_style_set_event (GtkWidget *widget,
GdkAtom realtype;
gint retfmt, retlen;
GdkColor *data, *stylecolors;
int i = 0, j;
int i = 0;
GdkColormap *widget_cmap;
atom_default_colors = gdk_atom_intern("_GTK_DEFAULT_COLORS", FALSE);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment