diff options
author | Matthias Clasen <matthiasc@src.gnome.org> | 2002-01-30 22:29:03 +0000 |
---|---|---|
committer | Matthias Clasen <matthiasc@src.gnome.org> | 2002-01-30 22:29:03 +0000 |
commit | 4dddfb2dc62a68196f0f3e52712a25c427275b37 (patch) | |
tree | 63c2d56da9bbafaf5d90b9a87d22ef483a7ad40f | |
parent | 95ab2a72b4ba0a84b9c430d941f778367e02584b (diff) | |
download | gtk+-4dddfb2dc62a68196f0f3e52712a25c427275b37.tar.gz |
Remove excess calls to g_return_if_fail from static and virtual functions.
40 files changed, 124 insertions, 625 deletions
@@ -1,3 +1,8 @@ +2002-01-30 Matthias Clasen <matthiasc@poet.de> + + * gtk/*.c: Remove excess g_return_if_fail calls from static + and virtual functions. + 2002-01-30 Anders Carlsson <andersca@gnu.org> * gtk/gtkstyle.c (gtk_default_render_icon): Allow a -1 icon size. diff --git a/ChangeLog.pre-2-0 b/ChangeLog.pre-2-0 index 2f65e52d83..1c09a9b5ea 100644 --- a/ChangeLog.pre-2-0 +++ b/ChangeLog.pre-2-0 @@ -1,3 +1,8 @@ +2002-01-30 Matthias Clasen <matthiasc@poet.de> + + * gtk/*.c: Remove excess g_return_if_fail calls from static + and virtual functions. + 2002-01-30 Anders Carlsson <andersca@gnu.org> * gtk/gtkstyle.c (gtk_default_render_icon): Allow a -1 icon size. diff --git a/ChangeLog.pre-2-10 b/ChangeLog.pre-2-10 index 2f65e52d83..1c09a9b5ea 100644 --- a/ChangeLog.pre-2-10 +++ b/ChangeLog.pre-2-10 @@ -1,3 +1,8 @@ +2002-01-30 Matthias Clasen <matthiasc@poet.de> + + * gtk/*.c: Remove excess g_return_if_fail calls from static + and virtual functions. + 2002-01-30 Anders Carlsson <andersca@gnu.org> * gtk/gtkstyle.c (gtk_default_render_icon): Allow a -1 icon size. diff --git a/ChangeLog.pre-2-2 b/ChangeLog.pre-2-2 index 2f65e52d83..1c09a9b5ea 100644 --- a/ChangeLog.pre-2-2 +++ b/ChangeLog.pre-2-2 @@ -1,3 +1,8 @@ +2002-01-30 Matthias Clasen <matthiasc@poet.de> + + * gtk/*.c: Remove excess g_return_if_fail calls from static + and virtual functions. + 2002-01-30 Anders Carlsson <andersca@gnu.org> * gtk/gtkstyle.c (gtk_default_render_icon): Allow a -1 icon size. diff --git a/ChangeLog.pre-2-4 b/ChangeLog.pre-2-4 index 2f65e52d83..1c09a9b5ea 100644 --- a/ChangeLog.pre-2-4 +++ b/ChangeLog.pre-2-4 @@ -1,3 +1,8 @@ +2002-01-30 Matthias Clasen <matthiasc@poet.de> + + * gtk/*.c: Remove excess g_return_if_fail calls from static + and virtual functions. + 2002-01-30 Anders Carlsson <andersca@gnu.org> * gtk/gtkstyle.c (gtk_default_render_icon): Allow a -1 icon size. diff --git a/ChangeLog.pre-2-6 b/ChangeLog.pre-2-6 index 2f65e52d83..1c09a9b5ea 100644 --- a/ChangeLog.pre-2-6 +++ b/ChangeLog.pre-2-6 @@ -1,3 +1,8 @@ +2002-01-30 Matthias Clasen <matthiasc@poet.de> + + * gtk/*.c: Remove excess g_return_if_fail calls from static + and virtual functions. + 2002-01-30 Anders Carlsson <andersca@gnu.org> * gtk/gtkstyle.c (gtk_default_render_icon): Allow a -1 icon size. diff --git a/ChangeLog.pre-2-8 b/ChangeLog.pre-2-8 index 2f65e52d83..1c09a9b5ea 100644 --- a/ChangeLog.pre-2-8 +++ b/ChangeLog.pre-2-8 @@ -1,3 +1,8 @@ +2002-01-30 Matthias Clasen <matthiasc@poet.de> + + * gtk/*.c: Remove excess g_return_if_fail calls from static + and virtual functions. + 2002-01-30 Anders Carlsson <andersca@gnu.org> * gtk/gtkstyle.c (gtk_default_render_icon): Allow a -1 icon size. diff --git a/gtk/gtkaccellabel.c b/gtk/gtkaccellabel.c index 67560b5775..efbd6b7386 100644 --- a/gtk/gtkaccellabel.c +++ b/gtk/gtkaccellabel.c @@ -210,11 +210,7 @@ gtk_accel_label_new (const gchar *string) static void gtk_accel_label_destroy (GtkObject *object) { - GtkAccelLabel *accel_label; - - g_return_if_fail (GTK_IS_ACCEL_LABEL (object)); - - accel_label = GTK_ACCEL_LABEL (object); + GtkAccelLabel *accel_label = GTK_ACCEL_LABEL (object); gtk_accel_label_set_accel_widget (accel_label, NULL); gtk_accel_label_set_accel_closure (accel_label, NULL); @@ -268,15 +264,10 @@ static void gtk_accel_label_size_request (GtkWidget *widget, GtkRequisition *requisition) { - GtkAccelLabel *accel_label; + GtkAccelLabel *accel_label = GTK_ACCEL_LABEL (widget); PangoLayout *layout; gint width; - g_return_if_fail (GTK_IS_ACCEL_LABEL (widget)); - g_return_if_fail (requisition != NULL); - - accel_label = GTK_ACCEL_LABEL (widget); - if (GTK_WIDGET_CLASS (parent_class)->size_request) GTK_WIDGET_CLASS (parent_class)->size_request (widget, requisition); @@ -291,15 +282,9 @@ static gboolean gtk_accel_label_expose_event (GtkWidget *widget, GdkEventExpose *event) { - GtkMisc *misc; - GtkAccelLabel *accel_label; + GtkAccelLabel *accel_label = GTK_ACCEL_LABEL (widget); + GtkMisc *misc = GTK_MISC (accel_label); PangoLayout *layout; - - g_return_val_if_fail (GTK_IS_ACCEL_LABEL (widget), FALSE); - g_return_val_if_fail (event != NULL, FALSE); - - accel_label = GTK_ACCEL_LABEL (widget); - misc = GTK_MISC (accel_label); if (GTK_WIDGET_DRAWABLE (accel_label)) { diff --git a/gtk/gtkalignment.c b/gtk/gtkalignment.c index e722df37e0..dbc42fd5ae 100644 --- a/gtk/gtkalignment.c +++ b/gtk/gtkalignment.c @@ -297,9 +297,6 @@ gtk_alignment_size_request (GtkWidget *widget, GtkAlignment *alignment; GtkBin *bin; - g_return_if_fail (GTK_IS_ALIGNMENT (widget)); - g_return_if_fail (requisition != NULL); - alignment = GTK_ALIGNMENT (widget); bin = GTK_BIN (widget); @@ -328,9 +325,6 @@ gtk_alignment_size_allocate (GtkWidget *widget, gint width, height; gint x, y; - g_return_if_fail (GTK_IS_ALIGNMENT (widget)); - g_return_if_fail (allocation != NULL); - widget->allocation = *allocation; alignment = GTK_ALIGNMENT (widget); bin = GTK_BIN (widget); diff --git a/gtk/gtkarrow.c b/gtk/gtkarrow.c index cb27a51dd8..5ce6b7eb31 100644 --- a/gtk/gtkarrow.c +++ b/gtk/gtkarrow.c @@ -234,10 +234,6 @@ gtk_arrow_expose (GtkWidget *widget, gint extent; gfloat xalign; - g_return_val_if_fail (widget != NULL, FALSE); - g_return_val_if_fail (GTK_IS_ARROW (widget), FALSE); - g_return_val_if_fail (event != NULL, FALSE); - if (GTK_WIDGET_DRAWABLE (widget)) { arrow = GTK_ARROW (widget); diff --git a/gtk/gtkbbox.c b/gtk/gtkbbox.c index 2c4c4307a0..6d77e83358 100644 --- a/gtk/gtkbbox.c +++ b/gtk/gtkbbox.c @@ -267,6 +267,8 @@ void gtk_button_box_set_child_size (GtkButtonBox *widget, gint width, gint height) { + g_return_if_fail (GTK_IS_BUTTON_BOX (widget)); + widget->child_min_width = width; widget->child_min_height = height; } @@ -275,6 +277,8 @@ void gtk_button_box_set_child_ipadding (GtkButtonBox *widget, gint ipad_x, gint ipad_y) { + g_return_if_fail (GTK_IS_BUTTON_BOX (widget)); + widget->child_ipad_x = ipad_x; widget->child_ipad_y = ipad_y; } @@ -283,6 +287,7 @@ void gtk_button_box_set_layout (GtkButtonBox *widget, GtkButtonBoxStyle layout_style) { + g_return_if_fail (GTK_IS_BUTTON_BOX (widget)); g_return_if_fail (layout_style >= GTK_BUTTONBOX_DEFAULT_STYLE && layout_style <= GTK_BUTTONBOX_END); @@ -301,6 +306,10 @@ void gtk_button_box_get_child_size (GtkButtonBox *widget, gint *width, gint *height) { + g_return_if_fail (GTK_IS_BUTTON_BOX (widget)); + g_return_if_fail (width != NULL); + g_return_if_fail (height != NULL); + *width = widget->child_min_width; *height = widget->child_min_height; } @@ -309,6 +318,10 @@ void gtk_button_box_get_child_ipadding (GtkButtonBox *widget, gint* ipad_x, gint *ipad_y) { + g_return_if_fail (GTK_IS_BUTTON_BOX (widget)); + g_return_if_fail (ipad_x != NULL); + g_return_if_fail (ipad_y != NULL); + *ipad_x = widget->child_ipad_x; *ipad_y = widget->child_ipad_y; } diff --git a/gtk/gtkbin.c b/gtk/gtkbin.c index e43042a166..d8a80eeca9 100644 --- a/gtk/gtkbin.c +++ b/gtk/gtkbin.c @@ -109,13 +109,10 @@ static void gtk_bin_add (GtkContainer *container, GtkWidget *child) { - GtkBin *bin; + GtkBin *bin = GTK_BIN (container); - g_return_if_fail (GTK_IS_BIN (container)); g_return_if_fail (GTK_IS_WIDGET (child)); - bin = GTK_BIN (container); - if (bin->child != NULL) { g_warning ("Attempting to add a widget with type %s to a %s, " @@ -136,13 +133,10 @@ static void gtk_bin_remove (GtkContainer *container, GtkWidget *child) { - GtkBin *bin; + GtkBin *bin = GTK_BIN (container); gboolean widget_was_visible; - g_return_if_fail (GTK_IS_BIN (container)); g_return_if_fail (GTK_IS_WIDGET (child)); - - bin = GTK_BIN (container); g_return_if_fail (bin->child == child); widget_was_visible = GTK_WIDGET_VISIBLE (child); @@ -163,13 +157,10 @@ gtk_bin_forall (GtkContainer *container, GtkCallback callback, gpointer callback_data) { - GtkBin *bin; + GtkBin *bin = GTK_BIN (container); - g_return_if_fail (GTK_IS_BIN (container)); g_return_if_fail (callback != NULL); - bin = GTK_BIN (container); - if (bin->child) (* callback) (bin->child, callback_data); } diff --git a/gtk/gtkbindings.c b/gtk/gtkbindings.c index 82a128db43..d80f6cfb51 100644 --- a/gtk/gtkbindings.c +++ b/gtk/gtkbindings.c @@ -548,7 +548,6 @@ gtk_binding_set_activate (GtkBindingSet *binding_set, GtkBindingEntry *entry; g_return_val_if_fail (binding_set != NULL, FALSE); - g_return_val_if_fail (object != NULL, FALSE); g_return_val_if_fail (GTK_IS_OBJECT (object), FALSE); keyval = gdk_keyval_to_lower (keyval); @@ -926,7 +925,6 @@ gtk_bindings_activate (GtkObject *object, GtkWidget *widget; gboolean handled = FALSE; - g_return_val_if_fail (object != NULL, FALSE); g_return_val_if_fail (GTK_IS_OBJECT (object), FALSE); if (!GTK_IS_WIDGET (object)) diff --git a/gtk/gtkbox.c b/gtk/gtkbox.c index 4c50b1137f..82e8aed048 100644 --- a/gtk/gtkbox.c +++ b/gtk/gtkbox.c @@ -356,7 +356,7 @@ gtk_box_pack_start (GtkBox *box, GtkBoxChild *child_info; g_return_if_fail (GTK_IS_BOX (box)); - g_return_if_fail (child != NULL); + g_return_if_fail (GTK_IS_WIDGET (child)); g_return_if_fail (child->parent == NULL); child_info = g_new (GtkBoxChild, 1); @@ -391,7 +391,7 @@ gtk_box_pack_end (GtkBox *box, GtkBoxChild *child_info; g_return_if_fail (GTK_IS_BOX (box)); - g_return_if_fail (child != NULL); + g_return_if_fail (GTK_IS_WIDGET (child)); g_return_if_fail (child->parent == NULL); child_info = g_new (GtkBoxChild, 1); @@ -420,9 +420,6 @@ void gtk_box_pack_start_defaults (GtkBox *box, GtkWidget *child) { - g_return_if_fail (GTK_IS_BOX (box)); - g_return_if_fail (child != NULL); - gtk_box_pack_start (box, child, TRUE, TRUE, 0); } @@ -430,9 +427,6 @@ void gtk_box_pack_end_defaults (GtkBox *box, GtkWidget *child) { - g_return_if_fail (GTK_IS_BOX (box)); - g_return_if_fail (child != NULL); - gtk_box_pack_end (box, child, TRUE, TRUE, 0); } @@ -505,7 +499,7 @@ gtk_box_reorder_child (GtkBox *box, GList *list; g_return_if_fail (GTK_IS_BOX (box)); - g_return_if_fail (child != NULL); + g_return_if_fail (GTK_IS_WIDGET (child)); list = box->children; while (list) @@ -572,7 +566,7 @@ gtk_box_query_child_packing (GtkBox *box, GtkBoxChild *child_info = NULL; g_return_if_fail (GTK_IS_BOX (box)); - g_return_if_fail (child != NULL); + g_return_if_fail (GTK_IS_WIDGET (child)); list = box->children; while (list) @@ -609,7 +603,7 @@ gtk_box_set_child_packing (GtkBox *box, GtkBoxChild *child_info = NULL; g_return_if_fail (GTK_IS_BOX (box)); - g_return_if_fail (child != NULL); + g_return_if_fail (GTK_IS_WIDGET (child)); list = box->children; while (list) @@ -646,9 +640,6 @@ static void gtk_box_add (GtkContainer *container, GtkWidget *widget) { - g_return_if_fail (GTK_IS_BOX (container)); - g_return_if_fail (widget != NULL); - gtk_box_pack_start_defaults (GTK_BOX (container), widget); } @@ -660,9 +651,6 @@ gtk_box_remove (GtkContainer *container, GtkBoxChild *child; GList *children; - g_return_if_fail (GTK_IS_BOX (container)); - g_return_if_fail (widget != NULL); - box = GTK_BOX (container); children = box->children; @@ -704,7 +692,6 @@ gtk_box_forall (GtkContainer *container, GtkBoxChild *child; GList *children; - g_return_if_fail (GTK_IS_BOX (container)); g_return_if_fail (callback != NULL); box = GTK_BOX (container); diff --git a/gtk/gtkbutton.c b/gtk/gtkbutton.c index 886b6abf3d..c0d4706874 100644 --- a/gtk/gtkbutton.c +++ b/gtk/gtkbutton.c @@ -595,8 +595,6 @@ gtk_button_realize (GtkWidget *widget) gint attributes_mask; gint border_width; - g_return_if_fail (GTK_IS_BUTTON (widget)); - button = GTK_BUTTON (widget); GTK_WIDGET_SET_FLAGS (widget, GTK_REALIZED); @@ -908,10 +906,6 @@ static gboolean gtk_button_expose (GtkWidget *widget, GdkEventExpose *event) { - g_return_val_if_fail (widget != NULL, FALSE); - g_return_val_if_fail (GTK_IS_BUTTON (widget), FALSE); - g_return_val_if_fail (event != NULL, FALSE); - if (GTK_WIDGET_DRAWABLE (widget)) { GtkButton *button = GTK_BUTTON (widget); @@ -933,10 +927,6 @@ gtk_button_button_press (GtkWidget *widget, { GtkButton *button; - g_return_val_if_fail (widget != NULL, FALSE); - g_return_val_if_fail (GTK_IS_BUTTON (widget), FALSE); - g_return_val_if_fail (event != NULL, FALSE); - if (event->type == GDK_BUTTON_PRESS) { button = GTK_BUTTON (widget); @@ -957,10 +947,6 @@ gtk_button_button_release (GtkWidget *widget, { GtkButton *button; - g_return_val_if_fail (widget != NULL, FALSE); - g_return_val_if_fail (GTK_IS_BUTTON (widget), FALSE); - g_return_val_if_fail (event != NULL, FALSE); - if (event->button == 1) { button = GTK_BUTTON (widget); @@ -994,10 +980,6 @@ gtk_button_enter_notify (GtkWidget *widget, GtkButton *button; GtkWidget *event_widget; - g_return_val_if_fail (widget != NULL, FALSE); - g_return_val_if_fail (GTK_IS_BUTTON (widget), FALSE); - g_return_val_if_fail (event != NULL, FALSE); - button = GTK_BUTTON (widget); event_widget = gtk_get_event_widget ((GdkEvent*) event); @@ -1018,10 +1000,6 @@ gtk_button_leave_notify (GtkWidget *widget, GtkButton *button; GtkWidget *event_widget; - g_return_val_if_fail (widget != NULL, FALSE); - g_return_val_if_fail (GTK_IS_BUTTON (widget), FALSE); - g_return_val_if_fail (event != NULL, FALSE); - button = GTK_BUTTON (widget); event_widget = gtk_get_event_widget ((GdkEvent*) event); @@ -1079,8 +1057,6 @@ gtk_real_button_activate (GtkButton *button) { GtkWidget *widget = GTK_WIDGET (button); - g_return_if_fail (GTK_IS_BUTTON (button)); - if (GTK_WIDGET_REALIZED (button) && !button->activate_timeout) { if (gdk_keyboard_grab (button->event_window, TRUE, diff --git a/gtk/gtkcalendar.c b/gtk/gtkcalendar.c index e5276ccc26..cb5d51ae7b 100644 --- a/gtk/gtkcalendar.c +++ b/gtk/gtkcalendar.c @@ -1014,8 +1014,6 @@ gtk_calendar_realize (GtkWidget *widget) gint attributes_mask; GdkGCValues values; - g_return_if_fail (GTK_IS_CALENDAR (widget)); - calendar = GTK_CALENDAR (widget); private_data = GTK_CALENDAR_PRIVATE_DATA (widget); @@ -1088,8 +1086,6 @@ gtk_calendar_unrealize (GtkWidget *widget) GtkCalendarPrivateData *private_data; gint i; - g_return_if_fail (GTK_IS_CALENDAR (widget)); - calendar = GTK_CALENDAR (widget); private_data = GTK_CALENDAR_PRIVATE_DATA (widget); @@ -1313,9 +1309,6 @@ gtk_calendar_size_allocate (GtkWidget *widget, GtkCalendar *calendar; GtkCalendarPrivateData *private_data; - g_return_if_fail (GTK_IS_CALENDAR (widget)); - g_return_if_fail (allocation != NULL); - widget->allocation = *allocation; calendar = GTK_CALENDAR (widget); @@ -1408,10 +1401,6 @@ gtk_calendar_expose (GtkWidget *widget, GtkCalendar *calendar; GtkCalendarPrivateData *private_data; - g_return_val_if_fail (widget != NULL, FALSE); - g_return_val_if_fail (GTK_IS_CALENDAR (widget), FALSE); - g_return_val_if_fail (event != NULL, FALSE); - calendar = GTK_CALENDAR (widget); private_data = GTK_CALENDAR_PRIVATE_DATA (widget); @@ -2086,7 +2075,6 @@ gtk_calendar_select_month (GtkCalendar *calendar, guint month, guint year) { - g_return_val_if_fail (calendar != NULL, FALSE); g_return_val_if_fail (GTK_IS_CALENDAR (calendar), FALSE); g_return_val_if_fail (month <= 11, FALSE); @@ -2158,7 +2146,6 @@ gboolean gtk_calendar_mark_day (GtkCalendar *calendar, guint day) { - g_return_val_if_fail (calendar != NULL, FALSE); g_return_val_if_fail (GTK_IS_CALENDAR (calendar), FALSE); if (day >= 1 && day <= 31 && calendar->marked_date[day-1] == FALSE) @@ -2178,7 +2165,6 @@ gboolean gtk_calendar_unmark_day (GtkCalendar *calendar, guint day) { - g_return_val_if_fail (calendar != NULL, FALSE); g_return_val_if_fail (GTK_IS_CALENDAR (calendar), FALSE); if (day >= 1 && day <= 31 && calendar->marked_date[day-1] == TRUE) @@ -2222,10 +2208,6 @@ gtk_calendar_button_press (GtkWidget *widget, gint x, y; void (* action_func) (GtkCalendar *); - g_return_val_if_fail (widget != NULL, FALSE); - g_return_val_if_fail (GTK_IS_CALENDAR (widget), FALSE); - g_return_val_if_fail (event != NULL, FALSE); - calendar = GTK_CALENDAR (widget); private_data = GTK_CALENDAR_PRIVATE_DATA (widget); @@ -2302,9 +2284,6 @@ gtk_calendar_enter_notify (GtkWidget *widget, GtkCalendar *calendar; GtkCalendarPrivateData *private_data; - g_return_val_if_fail (widget != NULL, FALSE); - g_return_val_if_fail (event != NULL, FALSE); - calendar = GTK_CALENDAR (widget); private_data = GTK_CALENDAR_PRIVATE_DATA (widget); @@ -2344,9 +2323,6 @@ gtk_calendar_leave_notify (GtkWidget *widget, gint row; gint col; - g_return_val_if_fail (widget != NULL, FALSE); - g_return_val_if_fail (event != NULL, FALSE); - calendar = GTK_CALENDAR (widget); private_data = GTK_CALENDAR_PRIVATE_DATA (widget); @@ -2398,8 +2374,6 @@ gtk_calendar_paint_arrow (GtkWidget *widget, gint state; gint width, height; - g_return_if_fail (widget != NULL); - calendar = GTK_CALENDAR (widget); private_data = GTK_CALENDAR_PRIVATE_DATA (widget); @@ -2476,8 +2450,6 @@ gtk_calendar_set_background (GtkWidget *widget) GtkCalendarPrivateData *private_data; gint i; - g_return_if_fail (GTK_IS_CALENDAR (widget)); - calendar = GTK_CALENDAR (widget); private_data = GTK_CALENDAR_PRIVATE_DATA (widget); @@ -2511,8 +2483,6 @@ static void gtk_calendar_style_set (GtkWidget *widget, GtkStyle *previous_style) { - g_return_if_fail (GTK_IS_CALENDAR (widget)); - if (previous_style && GTK_WIDGET_REALIZED (widget)) gtk_calendar_set_background(widget); } @@ -2521,8 +2491,6 @@ static void gtk_calendar_state_changed (GtkWidget *widget, GtkStateType previous_state) { - g_return_if_fail (GTK_IS_CALENDAR (widget)); - gtk_calendar_set_background (widget); } @@ -2545,10 +2513,6 @@ gtk_calendar_key_press (GtkWidget *widget, gint old_focus_row; gint old_focus_col; gint row, col, day; - - g_return_val_if_fail (widget != NULL, FALSE); - g_return_val_if_fail (GTK_IS_CALENDAR (widget), FALSE); - g_return_val_if_fail (event != NULL, FALSE); calendar = GTK_CALENDAR (widget); return_val = FALSE; diff --git a/gtk/gtkcheckbutton.c b/gtk/gtkcheckbutton.c index 9f6f76fcea..5ad62e7e0e 100644 --- a/gtk/gtkcheckbutton.c +++ b/gtk/gtkcheckbutton.c @@ -214,12 +214,7 @@ static void gtk_check_button_size_request (GtkWidget *widget, GtkRequisition *requisition) { - GtkToggleButton *toggle_button; - - g_return_if_fail (GTK_IS_CHECK_BUTTON (widget)); - g_return_if_fail (requisition != NULL); - - toggle_button = GTK_TOGGLE_BUTTON (widget); + GtkToggleButton *toggle_button = GTK_TOGGLE_BUTTON (widget); if (toggle_button->draw_indicator) { @@ -271,9 +266,6 @@ gtk_check_button_size_allocate (GtkWidget *widget, GtkButton *button; GtkAllocation child_allocation; - g_return_if_fail (GTK_IS_CHECK_BUTTON (widget)); - g_return_if_fail (allocation != NULL); - button = GTK_BUTTON (widget); check_button = GTK_CHECK_BUTTON (widget); toggle_button = GTK_TOGGLE_BUTTON (widget); @@ -335,10 +327,6 @@ gtk_check_button_expose (GtkWidget *widget, GtkToggleButton *toggle_button; GtkBin *bin; - g_return_val_if_fail (widget != NULL, FALSE); - g_return_val_if_fail (GTK_IS_CHECK_BUTTON (widget), FALSE); - g_return_val_if_fail (event != NULL, FALSE); - check_button = GTK_CHECK_BUTTON (widget); toggle_button = GTK_TOGGLE_BUTTON (widget); bin = GTK_BIN (widget); @@ -395,8 +383,6 @@ gtk_real_check_button_draw_indicator (GtkCheckButton *check_button, gboolean interior_focus; GdkWindow *window; - g_return_if_fail (GTK_IS_CHECK_BUTTON (check_button)); - widget = GTK_WIDGET (check_button); toggle_button = GTK_TOGGLE_BUTTON (check_button); diff --git a/gtk/gtkcheckmenuitem.c b/gtk/gtkcheckmenuitem.c index 36988feced..954142bb17 100644 --- a/gtk/gtkcheckmenuitem.c +++ b/gtk/gtkcheckmenuitem.c @@ -308,10 +308,6 @@ static gint gtk_check_menu_item_expose (GtkWidget *widget, GdkEventExpose *event) { - g_return_val_if_fail (widget != NULL, FALSE); - g_return_val_if_fail (GTK_IS_CHECK_MENU_ITEM (widget), FALSE); - g_return_val_if_fail (event != NULL, FALSE); - if (GTK_WIDGET_CLASS (parent_class)->expose_event) (* GTK_WIDGET_CLASS (parent_class)->expose_event) (widget, event); @@ -323,11 +319,7 @@ gtk_check_menu_item_expose (GtkWidget *widget, static void gtk_check_menu_item_activate (GtkMenuItem *menu_item) { - GtkCheckMenuItem *check_menu_item; - - g_return_if_fail (GTK_IS_CHECK_MENU_ITEM (menu_item)); - - check_menu_item = GTK_CHECK_MENU_ITEM (menu_item); + GtkCheckMenuItem *check_menu_item = GTK_CHECK_MENU_ITEM (menu_item); check_menu_item->active = !check_menu_item->active; gtk_check_menu_item_toggled (check_menu_item); @@ -340,9 +332,6 @@ static void gtk_check_menu_item_draw_indicator (GtkCheckMenuItem *check_menu_item, GdkRectangle *area) { - g_return_if_fail (GTK_IS_CHECK_MENU_ITEM (check_menu_item)); - g_return_if_fail (GTK_CHECK_MENU_ITEM_GET_CLASS (check_menu_item) != NULL); - if (GTK_CHECK_MENU_ITEM_GET_CLASS (check_menu_item)->draw_indicator) (* GTK_CHECK_MENU_ITEM_GET_CLASS (check_menu_item)->draw_indicator) (check_menu_item, area); } @@ -357,8 +346,6 @@ gtk_real_check_menu_item_draw_indicator (GtkCheckMenuItem *check_menu_item, gint width, height; gint x, y; - g_return_if_fail (GTK_IS_CHECK_MENU_ITEM (check_menu_item)); - if (GTK_WIDGET_DRAWABLE (check_menu_item)) { widget = GTK_WIDGET (check_menu_item); diff --git a/gtk/gtkcontainer.c b/gtk/gtkcontainer.c index 4bd9b8c631..b03a068a78 100644 --- a/gtk/gtkcontainer.c +++ b/gtk/gtkcontainer.c @@ -618,9 +618,7 @@ gtk_container_child_get (GtkContainer *container, { va_list var_args; - g_return_if_fail (container != NULL); g_return_if_fail (GTK_IS_CONTAINER (container)); - g_return_if_fail (child != NULL); g_return_if_fail (GTK_IS_WIDGET (child)); g_return_if_fail (child->parent == GTK_WIDGET (container)); @@ -716,12 +714,7 @@ gtk_container_init (GtkContainer *container) static void gtk_container_destroy (GtkObject *object) { - GtkContainer *container; - - g_return_if_fail (object != NULL); - g_return_if_fail (GTK_IS_CONTAINER (object)); - - container = GTK_CONTAINER (object); + GtkContainer *container = GTK_CONTAINER (object); if (GTK_CONTAINER_RESIZE_PENDING (container)) _gtk_container_dequeue_resize_handler (container); @@ -744,9 +737,7 @@ gtk_container_set_property (GObject *object, const GValue *value, GParamSpec *pspec) { - GtkContainer *container; - - container = GTK_CONTAINER (object); + GtkContainer *container = GTK_CONTAINER (object); switch (prop_id) { @@ -771,9 +762,7 @@ gtk_container_get_property (GObject *object, GValue *value, GParamSpec *pspec) { - GtkContainer *container; - - container = GTK_CONTAINER (object); + GtkContainer *container = GTK_CONTAINER (object); switch (prop_id) { @@ -809,7 +798,6 @@ void gtk_container_set_border_width (GtkContainer *container, guint border_width) { - g_return_if_fail (container != NULL); g_return_if_fail (GTK_IS_CONTAINER (container)); if (container->border_width != border_width) @@ -857,9 +845,7 @@ void gtk_container_add (GtkContainer *container, GtkWidget *widget) { - g_return_if_fail (container != NULL); g_return_if_fail (GTK_IS_CONTAINER (container)); - g_return_if_fail (widget != NULL); g_return_if_fail (GTK_IS_WIDGET (widget)); if (widget->parent != NULL) @@ -892,9 +878,7 @@ void gtk_container_remove (GtkContainer *container, GtkWidget *widget) { - g_return_if_fail (container != NULL); g_return_if_fail (GTK_IS_CONTAINER (container)); - g_return_if_fail (widget != NULL); g_return_if_fail (GTK_IS_WIDGET (widget)); g_return_if_fail (widget->parent == GTK_WIDGET (container)); @@ -926,7 +910,6 @@ void gtk_container_set_resize_mode (GtkContainer *container, GtkResizeMode resize_mode) { - g_return_if_fail (container != NULL); g_return_if_fail (GTK_IS_CONTAINER (container)); g_return_if_fail (resize_mode <= GTK_RESIZE_IMMEDIATE); @@ -984,9 +967,7 @@ gtk_container_set_reallocate_redraws (GtkContainer *container, static GtkContainer* gtk_container_get_resize_container (GtkContainer *container) { - GtkWidget *widget; - - widget = GTK_WIDGET (container); + GtkWidget *widget = GTK_WIDGET (container); while (widget->parent) { @@ -1035,7 +1016,6 @@ _gtk_container_queue_resize (GtkContainer *container) { GtkContainer *resize_container; - g_return_if_fail (container != NULL); g_return_if_fail (GTK_IS_CONTAINER (container)); resize_container = gtk_container_get_resize_container (container); @@ -1094,7 +1074,6 @@ _gtk_container_queue_resize (GtkContainer *container) void gtk_container_check_resize (GtkContainer *container) { - g_return_if_fail (container != NULL); g_return_if_fail (GTK_IS_CONTAINER (container)); gtk_signal_emit (GTK_OBJECT (container), container_signals[CHECK_RESIZE]); @@ -1103,14 +1082,9 @@ gtk_container_check_resize (GtkContainer *container) static void gtk_container_real_check_resize (GtkContainer *container) { - GtkWidget *widget; + GtkWidget *widget = GTK_WIDGET (container); GtkRequisition requisition; - g_return_if_fail (container != NULL); - g_return_if_fail (GTK_IS_CONTAINER (container)); - - widget = GTK_WIDGET (container); - gtk_widget_size_request (widget, &requisition); if (requisition.width > widget->allocation.width || @@ -1145,7 +1119,6 @@ gtk_container_resize_children (GtkContainer *container) * containers that have an idle sizer pending must be flagged with * RESIZE_PENDING. */ - g_return_if_fail (container != NULL); g_return_if_fail (GTK_IS_CONTAINER (container)); widget = GTK_WIDGET (container); @@ -1172,7 +1145,6 @@ gtk_container_forall (GtkContainer *container, { GtkContainerClass *class; - g_return_if_fail (container != NULL); g_return_if_fail (GTK_IS_CONTAINER (container)); g_return_if_fail (callback != NULL); @@ -1200,7 +1172,6 @@ gtk_container_foreach (GtkContainer *container, { GtkContainerClass *class; - g_return_if_fail (container != NULL); g_return_if_fail (GTK_IS_CONTAINER (container)); g_return_if_fail (callback != NULL); @@ -1244,7 +1215,6 @@ gtk_container_foreach_full (GtkContainer *container, gpointer callback_data, GtkDestroyNotify notify) { - g_return_if_fail (container != NULL); g_return_if_fail (GTK_IS_CONTAINER (container)); if (marshal) @@ -1272,7 +1242,6 @@ void gtk_container_set_focus_child (GtkContainer *container, GtkWidget *widget) { - g_return_if_fail (container != NULL); g_return_if_fail (GTK_IS_CONTAINER (container)); if (widget) g_return_if_fail (GTK_IS_WIDGET (widget)); @@ -1292,9 +1261,7 @@ gtk_container_set_focus_child (GtkContainer *container, GList* gtk_container_get_children (GtkContainer *container) { - GList *children; - - children = NULL; + GList *children = NULL; gtk_container_foreach (container, gtk_container_children_callback, @@ -1348,9 +1315,7 @@ gchar* _gtk_container_child_composite_name (GtkContainer *container, GtkWidget *child) { - g_return_val_if_fail (container != NULL, NULL); g_return_val_if_fail (GTK_IS_CONTAINER (container), NULL); - g_return_val_if_fail (child != NULL, NULL); g_return_val_if_fail (GTK_IS_WIDGET (child), NULL); g_return_val_if_fail (child->parent == GTK_WIDGET (container), NULL); @@ -1384,7 +1349,6 @@ static void gtk_container_real_set_focus_child (GtkContainer *container, GtkWidget *child) { - g_return_if_fail (container != NULL); g_return_if_fail (GTK_IS_CONTAINER (container)); if (child) g_return_if_fail (GTK_IS_WIDGET (child)); @@ -2085,7 +2049,6 @@ void gtk_container_set_focus_vadjustment (GtkContainer *container, GtkAdjustment *adjustment) { - g_return_if_fail (container != NULL); g_return_if_fail (GTK_IS_CONTAINER (container)); if (adjustment) g_return_if_fail (GTK_IS_ADJUSTMENT (adjustment)); @@ -2126,7 +2089,6 @@ void gtk_container_set_focus_hadjustment (GtkContainer *container, GtkAdjustment *adjustment) { - g_return_if_fail (container != NULL); g_return_if_fail (GTK_IS_CONTAINER (container)); if (adjustment) g_return_if_fail (GTK_IS_ADJUSTMENT (adjustment)); @@ -2167,7 +2129,6 @@ gtk_container_get_focus_hadjustment (GtkContainer *container) static void gtk_container_show_all (GtkWidget *widget) { - g_return_if_fail (widget != NULL); g_return_if_fail (GTK_IS_CONTAINER (widget)); gtk_container_foreach (GTK_CONTAINER (widget), @@ -2179,7 +2140,6 @@ gtk_container_show_all (GtkWidget *widget) static void gtk_container_hide_all (GtkWidget *widget) { - g_return_if_fail (widget != NULL); g_return_if_fail (GTK_IS_CONTAINER (widget)); gtk_widget_hide (widget); @@ -2212,7 +2172,6 @@ gtk_container_expose (GtkWidget *widget, GdkEventExpose *event; } data; - g_return_val_if_fail (widget != NULL, FALSE); g_return_val_if_fail (GTK_IS_CONTAINER (widget), FALSE); g_return_val_if_fail (event != NULL, FALSE); diff --git a/gtk/gtkeventbox.c b/gtk/gtkeventbox.c index 5abeabaa9f..430fe0e001 100644 --- a/gtk/gtkeventbox.c +++ b/gtk/gtkeventbox.c @@ -92,7 +92,7 @@ gtk_event_box_init (GtkEventBox *event_box) GtkWidget* gtk_event_box_new (void) { - return GTK_WIDGET ( gtk_type_new (gtk_event_box_get_type ())); + return GTK_WIDGET (gtk_type_new (gtk_event_box_get_type ())); } static void @@ -102,8 +102,6 @@ gtk_event_box_realize (GtkWidget *widget) gint attributes_mask; gint border_width; - g_return_if_fail (GTK_IS_EVENT_BOX (widget)); - GTK_WIDGET_SET_FLAGS (widget, GTK_REALIZED); border_width = GTK_CONTAINER (widget)->border_width; @@ -137,12 +135,7 @@ static void gtk_event_box_size_request (GtkWidget *widget, GtkRequisition *requisition) { - GtkBin *bin; - - g_return_if_fail (GTK_IS_EVENT_BOX (widget)); - g_return_if_fail (requisition != NULL); - - bin = GTK_BIN (widget); + GtkBin *bin = GTK_BIN (widget); requisition->width = GTK_CONTAINER (widget)->border_width * 2; requisition->height = GTK_CONTAINER (widget)->border_width * 2; @@ -165,9 +158,6 @@ gtk_event_box_size_allocate (GtkWidget *widget, GtkBin *bin; GtkAllocation child_allocation; - g_return_if_fail (GTK_IS_EVENT_BOX (widget)); - g_return_if_fail (allocation != NULL); - widget->allocation = *allocation; bin = GTK_BIN (widget); @@ -205,9 +195,6 @@ static gint gtk_event_box_expose (GtkWidget *widget, GdkEventExpose *event) { - g_return_val_if_fail (GTK_IS_EVENT_BOX (widget), FALSE); - g_return_val_if_fail (event != NULL, FALSE); - if (GTK_WIDGET_DRAWABLE (widget)) { gtk_event_box_paint (widget, &event->area); diff --git a/gtk/gtkfixed.c b/gtk/gtkfixed.c index ccd6db5bbb..d48c6604c2 100644 --- a/gtk/gtkfixed.c +++ b/gtk/gtkfixed.c @@ -188,7 +188,7 @@ gtk_fixed_put (GtkFixed *fixed, GtkFixedChild *child_info; g_return_if_fail (GTK_IS_FIXED (fixed)); - g_return_if_fail (widget != NULL); + g_return_if_fail (GTK_IS_WIDGET (fixed)); child_info = g_new (GtkFixedChild, 1); child_info->widget = widget; @@ -244,10 +244,6 @@ gtk_fixed_move (GtkFixed *fixed, gint x, gint y) { - g_return_if_fail (GTK_IS_FIXED (fixed)); - g_return_if_fail (GTK_IS_WIDGET (widget)); - g_return_if_fail (widget->parent == GTK_WIDGET (fixed)); - gtk_fixed_move_internal (fixed, widget, TRUE, x, TRUE, y); } @@ -309,8 +305,6 @@ gtk_fixed_realize (GtkWidget *widget) GdkWindowAttr attributes; gint attributes_mask; - g_return_if_fail (GTK_IS_FIXED (widget)); - if (GTK_WIDGET_NO_WINDOW (widget)) GTK_WIDGET_CLASS (parent_class)->realize (widget); else @@ -348,9 +342,6 @@ gtk_fixed_size_request (GtkWidget *widget, GList *children; GtkRequisition child_requisition; - g_return_if_fail (GTK_IS_FIXED (widget)); - g_return_if_fail (requisition != NULL); - fixed = GTK_FIXED (widget); requisition->width = 0; requisition->height = 0; @@ -389,9 +380,6 @@ gtk_fixed_size_allocate (GtkWidget *widget, GList *children; guint16 border_width; - g_return_if_fail (GTK_IS_FIXED(widget)); - g_return_if_fail (allocation != NULL); - fixed = GTK_FIXED (widget); widget->allocation = *allocation; @@ -437,9 +425,6 @@ static void gtk_fixed_add (GtkContainer *container, GtkWidget *widget) { - g_return_if_fail (GTK_IS_FIXED (container)); - g_return_if_fail (widget != NULL); - gtk_fixed_put (GTK_FIXED (container), widget, 0, 0); } @@ -451,9 +436,6 @@ gtk_fixed_remove (GtkContainer *container, GtkFixedChild *child; GList *children; - g_return_if_fail (GTK_IS_FIXED (container)); - g_return_if_fail (widget != NULL); - fixed = GTK_FIXED (container); children = fixed->children; @@ -491,7 +473,6 @@ gtk_fixed_forall (GtkContainer *container, GtkFixedChild *child; GList *children; - g_return_if_fail (GTK_IS_FIXED (container)); g_return_if_fail (callback != NULL); fixed = GTK_FIXED (container); diff --git a/gtk/gtkhandlebox.c b/gtk/gtkhandlebox.c index d4d0125654..729c9aafd0 100644 --- a/gtk/gtkhandlebox.c +++ b/gtk/gtkhandlebox.c @@ -328,11 +328,7 @@ gtk_handle_box_new (void) static void gtk_handle_box_destroy (GtkObject *object) { - GtkHandleBox *hb; - - g_return_if_fail (GTK_IS_HANDLE_BOX (object)); - - hb = GTK_HANDLE_BOX (object); + GtkHandleBox *hb = GTK_HANDLE_BOX (object); if (GTK_OBJECT_CLASS (parent_class)->destroy) (* GTK_OBJECT_CLASS (parent_class)->destroy) (object); @@ -344,8 +340,6 @@ gtk_handle_box_map (GtkWidget *widget) GtkBin *bin; GtkHandleBox *hb; - g_return_if_fail (GTK_IS_HANDLE_BOX (widget)); - GTK_WIDGET_SET_FLAGS (widget, GTK_MAPPED); bin = GTK_BIN (widget); @@ -371,8 +365,6 @@ gtk_handle_box_unmap (GtkWidget *widget) { GtkHandleBox *hb; - g_return_if_fail (GTK_IS_HANDLE_BOX (widget)); - GTK_WIDGET_UNSET_FLAGS (widget, GTK_MAPPED); hb = GTK_HANDLE_BOX (widget); @@ -392,8 +384,6 @@ gtk_handle_box_realize (GtkWidget *widget) gint attributes_mask; GtkHandleBox *hb; - g_return_if_fail (GTK_IS_HANDLE_BOX (widget)); - hb = GTK_HANDLE_BOX (widget); GTK_WIDGET_SET_FLAGS (widget, GTK_REALIZED); @@ -459,11 +449,7 @@ gtk_handle_box_realize (GtkWidget *widget) static void gtk_handle_box_unrealize (GtkWidget *widget) { - GtkHandleBox *hb; - - g_return_if_fail (GTK_IS_HANDLE_BOX (widget)); - - hb = GTK_HANDLE_BOX (widget); + GtkHandleBox *hb = GTK_HANDLE_BOX (widget); gdk_window_set_user_data (hb->bin_window, NULL); gdk_window_destroy (hb->bin_window); @@ -480,11 +466,7 @@ static void gtk_handle_box_style_set (GtkWidget *widget, GtkStyle *previous_style) { - GtkHandleBox *hb; - - g_return_if_fail (GTK_IS_HANDLE_BOX (widget)); - - hb = GTK_HANDLE_BOX (widget); + GtkHandleBox *hb = GTK_HANDLE_BOX (widget); if (GTK_WIDGET_REALIZED (widget) && !GTK_WIDGET_NO_WINDOW (widget)) @@ -504,9 +486,6 @@ gtk_handle_box_size_request (GtkWidget *widget, GtkHandleBox *hb; GtkRequisition child_requisition; - g_return_if_fail (GTK_IS_HANDLE_BOX (widget)); - g_return_if_fail (requisition != NULL); - bin = GTK_BIN (widget); hb = GTK_HANDLE_BOX (widget); @@ -579,9 +558,6 @@ gtk_handle_box_size_allocate (GtkWidget *widget, GtkHandleBox *hb; GtkRequisition child_requisition; - g_return_if_fail (GTK_IS_HANDLE_BOX (widget)); - g_return_if_fail (allocation != NULL); - bin = GTK_BIN (widget); hb = GTK_HANDLE_BOX (widget); @@ -770,6 +746,8 @@ void gtk_handle_box_set_handle_position (GtkHandleBox *handle_box, GtkPositionType position) { + g_return_if_fail (GTK_IS_HANDLE_BOX (handle_box)); + if ((GtkPositionType) handle_box->handle_position != position) { handle_box->handle_position = position; @@ -919,9 +897,6 @@ gtk_handle_box_expose (GtkWidget *widget, { GtkHandleBox *hb; - g_return_val_if_fail (GTK_IS_HANDLE_BOX (widget), FALSE); - g_return_val_if_fail (event != NULL, FALSE); - if (GTK_WIDGET_DRAWABLE (widget)) { hb = GTK_HANDLE_BOX (widget); @@ -946,9 +921,6 @@ gtk_handle_box_button_changed (GtkWidget *widget, gboolean event_handled; GdkCursor *fleur; - g_return_val_if_fail (GTK_IS_HANDLE_BOX (widget), FALSE); - g_return_val_if_fail (event != NULL, FALSE); - hb = GTK_HANDLE_BOX (widget); event_handled = FALSE; @@ -1064,9 +1036,6 @@ gtk_handle_box_motion (GtkWidget *widget, gint snap_edge; gboolean is_snapped = FALSE; - g_return_val_if_fail (GTK_IS_HANDLE_BOX (widget), FALSE); - g_return_val_if_fail (event != NULL, FALSE); - hb = GTK_HANDLE_BOX (widget); if (!hb->in_drag) return FALSE; @@ -1242,10 +1211,6 @@ static void gtk_handle_box_add (GtkContainer *container, GtkWidget *widget) { - g_return_if_fail (GTK_IS_HANDLE_BOX (container)); - g_return_if_fail (GTK_BIN (container)->child == NULL); - g_return_if_fail (widget->parent == NULL); - gtk_widget_set_parent_window (widget, GTK_HANDLE_BOX (container)->bin_window); GTK_CONTAINER_CLASS (parent_class)->add (container, widget); } @@ -1254,9 +1219,6 @@ static void gtk_handle_box_remove (GtkContainer *container, GtkWidget *widget) { - g_return_if_fail (GTK_IS_HANDLE_BOX (container)); - g_return_if_fail (GTK_BIN (container)->child == widget); - GTK_CONTAINER_CLASS (parent_class)->remove (container, widget); gtk_handle_box_reattach (GTK_HANDLE_BOX (container)); @@ -1266,12 +1228,7 @@ static gint gtk_handle_box_delete_event (GtkWidget *widget, GdkEventAny *event) { - GtkHandleBox *hb; - - g_return_val_if_fail (GTK_IS_HANDLE_BOX (widget), FALSE); - g_return_val_if_fail (event != NULL, FALSE); - - hb = GTK_HANDLE_BOX (widget); + GtkHandleBox *hb = GTK_HANDLE_BOX (widget); if (event->window == hb->float_window) { diff --git a/gtk/gtkhbbox.c b/gtk/gtkhbbox.c index 950cbae5a9..fee56b4177 100644 --- a/gtk/gtkhbbox.c +++ b/gtk/gtkhbbox.c @@ -141,10 +141,6 @@ gtk_hbutton_box_size_request (GtkWidget *widget, gint spacing; GtkButtonBoxStyle layout; - g_return_if_fail (widget != NULL); - g_return_if_fail (GTK_IS_HBUTTON_BOX (widget)); - g_return_if_fail (requisition != NULL); - box = GTK_BOX (widget); bbox = GTK_BUTTON_BOX (widget); @@ -213,10 +209,6 @@ gtk_hbutton_box_size_allocate (GtkWidget *widget, GtkButtonBoxStyle layout; gint spacing; - g_return_if_fail (widget != NULL); - g_return_if_fail (GTK_IS_HBUTTON_BOX (widget)); - g_return_if_fail (allocation != NULL); - base_box = GTK_BOX (widget); box = GTK_BUTTON_BOX (widget); hbox = GTK_HBUTTON_BOX (widget); diff --git a/gtk/gtkhbox.c b/gtk/gtkhbox.c index ac18734576..2d85593e95 100644 --- a/gtk/gtkhbox.c +++ b/gtk/gtkhbox.c @@ -101,9 +101,6 @@ gtk_hbox_size_request (GtkWidget *widget, gint nvis_children; gint width; - g_return_if_fail (GTK_IS_HBOX (widget)); - g_return_if_fail (requisition != NULL); - box = GTK_BOX (widget); requisition->width = 0; requisition->height = 0; @@ -164,9 +161,6 @@ gtk_hbox_size_allocate (GtkWidget *widget, gint x; GtkTextDirection direction; - g_return_if_fail (GTK_IS_HBOX (widget)); - g_return_if_fail (allocation != NULL); - box = GTK_BOX (widget); widget->allocation = *allocation; diff --git a/gtk/gtkhruler.c b/gtk/gtkhruler.c index 573b6e03f2..320c14942c 100644 --- a/gtk/gtkhruler.c +++ b/gtk/gtkhruler.c @@ -110,9 +110,6 @@ gtk_hruler_motion_notify (GtkWidget *widget, GtkRuler *ruler; gint x; - g_return_val_if_fail (GTK_IS_HRULER (widget), FALSE); - g_return_val_if_fail (event != NULL, FALSE); - ruler = GTK_RULER (widget); if (event->is_hint) @@ -153,8 +150,6 @@ gtk_hruler_draw_ticks (GtkRuler *ruler) PangoLayout *layout; PangoRectangle logical_rect, ink_rect; - g_return_if_fail (GTK_IS_HRULER (ruler)); - if (!GTK_WIDGET_DRAWABLE (ruler)) return; @@ -287,8 +282,6 @@ gtk_hruler_draw_pos (GtkRuler *ruler) gint ythickness; gdouble increment; - g_return_if_fail (GTK_IS_HRULER (ruler)); - if (GTK_WIDGET_DRAWABLE (ruler)) { widget = GTK_WIDGET (ruler); diff --git a/gtk/gtkhseparator.c b/gtk/gtkhseparator.c index 5a87dc53d9..7da54bf5a2 100644 --- a/gtk/gtkhseparator.c +++ b/gtk/gtkhseparator.c @@ -86,9 +86,6 @@ static gint gtk_hseparator_expose (GtkWidget *widget, GdkEventExpose *event) { - g_return_val_if_fail (GTK_IS_HSEPARATOR (widget), FALSE); - g_return_val_if_fail (event != NULL, FALSE); - if (GTK_WIDGET_DRAWABLE (widget)) gtk_paint_hline (widget->style, widget->window, GTK_STATE_NORMAL, &event->area, widget, "hseparator", diff --git a/gtk/gtkimagemenuitem.c b/gtk/gtkimagemenuitem.c index 58bba7883c..19f8f41014 100644 --- a/gtk/gtkimagemenuitem.c +++ b/gtk/gtkimagemenuitem.c @@ -182,11 +182,7 @@ static void gtk_image_menu_item_toggle_size_request (GtkMenuItem *menu_item, gint *requisition) { - GtkImageMenuItem *image_menu_item; - - g_return_if_fail (GTK_IS_IMAGE_MENU_ITEM (menu_item)); - - image_menu_item = GTK_IMAGE_MENU_ITEM (menu_item); + GtkImageMenuItem *image_menu_item = GTK_IMAGE_MENU_ITEM (menu_item); if (image_menu_item->image) *requisition = image_menu_item->image->requisition.width; @@ -269,11 +265,7 @@ gtk_image_menu_item_forall (GtkContainer *container, GtkCallback callback, gpointer callback_data) { - GtkImageMenuItem *image_menu_item; - - g_return_if_fail (GTK_IS_IMAGE_MENU_ITEM (container)); - - image_menu_item = GTK_IMAGE_MENU_ITEM (container); + GtkImageMenuItem *image_menu_item = GTK_IMAGE_MENU_ITEM (container); (* GTK_CONTAINER_CLASS (parent_class)->forall) (container, include_internals, diff --git a/gtk/gtkinvisible.c b/gtk/gtkinvisible.c index 529b3b3688..e15de3eb5c 100644 --- a/gtk/gtkinvisible.c +++ b/gtk/gtkinvisible.c @@ -125,8 +125,6 @@ gtk_invisible_realize (GtkWidget *widget) GdkWindowAttr attributes; gint attributes_mask; - g_return_if_fail (GTK_IS_INVISIBLE (widget)); - GTK_WIDGET_SET_FLAGS (widget, GTK_REALIZED); attributes.x = -100; @@ -156,8 +154,6 @@ gtk_invisible_style_set (GtkWidget *widget, static void gtk_invisible_show (GtkWidget *widget) { - g_return_if_fail (widget != NULL); - GTK_WIDGET_SET_FLAGS (widget, GTK_VISIBLE); gtk_widget_map (widget); } diff --git a/gtk/gtkpaned.c b/gtk/gtkpaned.c index b14996687d..b0e3385e46 100644 --- a/gtk/gtkpaned.c +++ b/gtk/gtkpaned.c @@ -223,8 +223,6 @@ gtk_paned_realize (GtkWidget *widget) GdkWindowAttr attributes; gint attributes_mask; - g_return_if_fail (GTK_IS_PANED (widget)); - GTK_WIDGET_SET_FLAGS (widget, GTK_REALIZED); paned = GTK_PANED (widget); @@ -259,11 +257,7 @@ gtk_paned_realize (GtkWidget *widget) static void gtk_paned_unrealize (GtkWidget *widget) { - GtkPaned *paned; - - g_return_if_fail (GTK_IS_PANED (widget)); - - paned = GTK_PANED (widget); + GtkPaned *paned = GTK_PANED (widget); if (paned->xor_gc) { @@ -287,8 +281,6 @@ gtk_paned_map (GtkWidget *widget) { GtkPaned *paned = GTK_PANED (widget); - g_return_if_fail (GTK_IS_PANED (widget)); - gdk_window_show (paned->handle); GTK_WIDGET_CLASS (parent_class)->map (widget); @@ -299,8 +291,6 @@ gtk_paned_unmap (GtkWidget *widget) { GtkPaned *paned = GTK_PANED (widget); - g_return_if_fail (GTK_IS_PANED (widget)); - gdk_window_hide (paned->handle); GTK_WIDGET_CLASS (parent_class)->unmap (widget); @@ -312,8 +302,6 @@ gtk_paned_expose (GtkWidget *widget, { GtkPaned *paned = GTK_PANED (widget); - g_return_val_if_fail (GTK_IS_PANED (widget), FALSE); - if (GTK_WIDGET_VISIBLE (widget) && GTK_WIDGET_MAPPED (widget) && paned->child1 && GTK_WIDGET_VISIBLE (paned->child1) && paned->child2 && GTK_WIDGET_VISIBLE (paned->child2)) @@ -406,14 +394,13 @@ gtk_paned_add (GtkContainer *container, GtkPaned *paned; g_return_if_fail (GTK_IS_PANED (container)); - g_return_if_fail (widget != NULL); paned = GTK_PANED (container); if (!paned->child1) - gtk_paned_add1 (GTK_PANED (container), widget); + gtk_paned_add1 (paned, widget); else if (!paned->child2) - gtk_paned_add2 (GTK_PANED (container), widget); + gtk_paned_add2 (paned, widget); } static void @@ -423,9 +410,6 @@ gtk_paned_remove (GtkContainer *container, GtkPaned *paned; gboolean was_visible; - g_return_if_fail (GTK_IS_PANED (container)); - g_return_if_fail (widget != NULL); - paned = GTK_PANED (container); was_visible = GTK_WIDGET_VISIBLE (widget); @@ -457,7 +441,6 @@ gtk_paned_forall (GtkContainer *container, { GtkPaned *paned; - g_return_if_fail (GTK_IS_PANED (container)); g_return_if_fail (callback != NULL); paned = GTK_PANED (container); diff --git a/gtk/gtkradiobutton.c b/gtk/gtkradiobutton.c index ea4b8d5567..bc672a768a 100644 --- a/gtk/gtkradiobutton.c +++ b/gtk/gtkradiobutton.c @@ -315,8 +315,6 @@ gtk_radio_button_destroy (GtkObject *object) GtkRadioButton *tmp_button; GSList *tmp_list; - g_return_if_fail (GTK_IS_RADIO_BUTTON (object)); - radio_button = GTK_RADIO_BUTTON (object); radio_button->group = g_slist_remove (radio_button->group, radio_button); @@ -498,8 +496,6 @@ gtk_radio_button_clicked (GtkButton *button) gint toggled; gboolean depressed; - g_return_if_fail (GTK_IS_RADIO_BUTTON (button)); - radio_button = GTK_RADIO_BUTTON (button); toggle_button = GTK_TOGGLE_BUTTON (button); toggled = FALSE; @@ -591,8 +587,6 @@ gtk_radio_button_draw_indicator (GtkCheckButton *check_button, gint focus_pad; gboolean interior_focus; - g_return_if_fail (GTK_IS_RADIO_BUTTON (check_button)); - if (GTK_WIDGET_VISIBLE (check_button) && GTK_WIDGET_MAPPED (check_button)) { widget = GTK_WIDGET (check_button); diff --git a/gtk/gtkrange.c b/gtk/gtkrange.c index 14bcead6f4..064c1840b4 100644 --- a/gtk/gtkrange.c +++ b/gtk/gtkrange.c @@ -661,11 +661,7 @@ should_invert (GtkRange *range) static void gtk_range_finalize (GObject *object) { - GtkRange *range; - - g_return_if_fail (GTK_IS_RANGE (object)); - - range = GTK_RANGE (object); + GtkRange *range = GTK_RANGE (object); g_free (range->layout); @@ -675,11 +671,7 @@ gtk_range_finalize (GObject *object) static void gtk_range_destroy (GtkObject *object) { - GtkRange *range; - - g_return_if_fail (GTK_IS_RANGE (object)); - - range = GTK_RANGE (object); + GtkRange *range = GTK_RANGE (object); gtk_range_remove_step_timer (range); gtk_range_remove_update_timer (range); @@ -782,11 +774,7 @@ gtk_range_realize (GtkWidget *widget) static void gtk_range_unrealize (GtkWidget *widget) { - GtkRange *range; - - g_return_if_fail (GTK_IS_RANGE (widget)); - - range = GTK_RANGE (widget); + GtkRange *range = GTK_RANGE (widget); gtk_range_remove_step_timer (range); gtk_range_remove_update_timer (range); @@ -879,9 +867,6 @@ gtk_range_expose (GtkWidget *widget, GdkRectangle expose_area; /* Relative to widget->allocation */ GdkRectangle area; - g_return_val_if_fail (GTK_IS_RANGE (widget), FALSE); - g_return_val_if_fail (event != NULL, FALSE); - range = GTK_RANGE (widget); expose_area = event->area; @@ -1106,12 +1091,7 @@ static gint gtk_range_button_press (GtkWidget *widget, GdkEventButton *event) { - GtkRange *range; - - g_return_val_if_fail (GTK_IS_RANGE (widget), FALSE); - g_return_val_if_fail (event != NULL, FALSE); - - range = GTK_RANGE (widget); + GtkRange *range = GTK_RANGE (widget); if (!GTK_WIDGET_HAS_FOCUS (widget)) gtk_widget_grab_focus (widget); @@ -1259,12 +1239,7 @@ static gint gtk_range_button_release (GtkWidget *widget, GdkEventButton *event) { - GtkRange *range; - - g_return_val_if_fail (GTK_IS_RANGE (widget), FALSE); - g_return_val_if_fail (event != NULL, FALSE); - - range = GTK_RANGE (widget); + GtkRange *range = GTK_RANGE (widget); range->layout->mouse_x = event->x; range->layout->mouse_y = event->y; @@ -1311,12 +1286,7 @@ static gint gtk_range_scroll_event (GtkWidget *widget, GdkEventScroll *event) { - GtkRange *range; - - g_return_val_if_fail (GTK_IS_RANGE (widget), FALSE); - g_return_val_if_fail (event != NULL, FALSE); - - range = GTK_RANGE (widget); + GtkRange *range = GTK_RANGE (widget); if (GTK_WIDGET_REALIZED (range)) { @@ -1346,9 +1316,6 @@ gtk_range_motion_notify (GtkWidget *widget, GtkRange *range; gint x, y; - g_return_val_if_fail (GTK_IS_RANGE (widget), FALSE); - g_return_val_if_fail (event != NULL, FALSE); - range = GTK_RANGE (widget); gdk_window_get_pointer (range->event_window, &x, &y, NULL); @@ -1370,12 +1337,7 @@ static gint gtk_range_enter_notify (GtkWidget *widget, GdkEventCrossing *event) { - GtkRange *range; - - g_return_val_if_fail (GTK_IS_RANGE (widget), FALSE); - g_return_val_if_fail (event != NULL, FALSE); - - range = GTK_RANGE (widget); + GtkRange *range = GTK_RANGE (widget); range->layout->mouse_x = event->x; range->layout->mouse_y = event->y; @@ -1390,12 +1352,7 @@ static gint gtk_range_leave_notify (GtkWidget *widget, GdkEventCrossing *event) { - GtkRange *range; - - g_return_val_if_fail (GTK_IS_RANGE (widget), FALSE); - g_return_val_if_fail (event != NULL, FALSE); - - range = GTK_RANGE (widget); + GtkRange *range = GTK_RANGE (widget); range->layout->mouse_x = -1; range->layout->mouse_y = -1; @@ -1410,12 +1367,7 @@ static void gtk_range_adjustment_changed (GtkAdjustment *adjustment, gpointer data) { - GtkRange *range; - - g_return_if_fail (adjustment != NULL); - g_return_if_fail (data != NULL); - - range = GTK_RANGE (data); + GtkRange *range = GTK_RANGE (data); range->need_recalc = TRUE; gtk_widget_queue_draw (GTK_WIDGET (range)); @@ -1433,12 +1385,7 @@ static void gtk_range_adjustment_value_changed (GtkAdjustment *adjustment, gpointer data) { - GtkRange *range; - - g_return_if_fail (adjustment != NULL); - g_return_if_fail (data != NULL); - - range = GTK_RANGE (data); + GtkRange *range = GTK_RANGE (data); range->need_recalc = TRUE; @@ -1462,11 +1409,7 @@ static void gtk_range_style_set (GtkWidget *widget, GtkStyle *previous_style) { - GtkRange *range; - - g_return_if_fail (GTK_IS_RANGE (widget)); - - range = GTK_RANGE (widget); + GtkRange *range = GTK_RANGE (widget); range->need_recalc = TRUE; diff --git a/gtk/gtkruler.c b/gtk/gtkruler.c index fa6c6dd1d7..7553fec1cc 100644 --- a/gtk/gtkruler.c +++ b/gtk/gtkruler.c @@ -355,8 +355,6 @@ gtk_ruler_realize (GtkWidget *widget) GdkWindowAttr attributes; gint attributes_mask; - g_return_if_fail (GTK_IS_RULER (widget)); - ruler = GTK_RULER (widget); GTK_WIDGET_SET_FLAGS (ruler, GTK_REALIZED); @@ -387,11 +385,7 @@ gtk_ruler_realize (GtkWidget *widget) static void gtk_ruler_unrealize (GtkWidget *widget) { - GtkRuler *ruler; - - g_return_if_fail (GTK_IS_RULER (widget)); - - ruler = GTK_RULER (widget); + GtkRuler *ruler = GTK_RULER (widget); if (ruler->backing_store) gdk_pixmap_unref (ruler->backing_store); @@ -409,11 +403,8 @@ static void gtk_ruler_size_allocate (GtkWidget *widget, GtkAllocation *allocation) { - GtkRuler *ruler; - - g_return_if_fail (GTK_IS_RULER (widget)); + GtkRuler *ruler = GTK_RULER (widget); - ruler = GTK_RULER (widget); widget->allocation = *allocation; if (GTK_WIDGET_REALIZED (widget)) @@ -432,9 +423,6 @@ gtk_ruler_expose (GtkWidget *widget, { GtkRuler *ruler; - g_return_val_if_fail (GTK_IS_RULER (widget), FALSE); - g_return_val_if_fail (event != NULL, FALSE); - if (GTK_WIDGET_DRAWABLE (widget)) { ruler = GTK_RULER (widget); diff --git a/gtk/gtkspinbutton.c b/gtk/gtkspinbutton.c index 56547fa69f..d43edfdd82 100644 --- a/gtk/gtkspinbutton.c +++ b/gtk/gtkspinbutton.c @@ -447,8 +447,6 @@ gtk_spin_button_init (GtkSpinButton *spin_button) static void gtk_spin_button_finalize (GObject *object) { - g_return_if_fail (GTK_IS_SPIN_BUTTON (object)); - gtk_object_unref (GTK_OBJECT (GTK_SPIN_BUTTON (object)->adjustment)); G_OBJECT_CLASS (parent_class)->finalize (object); @@ -465,8 +463,6 @@ gtk_spin_button_destroy (GtkObject *object) static void gtk_spin_button_map (GtkWidget *widget) { - g_return_if_fail (GTK_IS_SPIN_BUTTON (widget)); - if (GTK_WIDGET_REALIZED (widget) && !GTK_WIDGET_MAPPED (widget)) { GTK_WIDGET_CLASS (parent_class)->map (widget); @@ -477,8 +473,6 @@ gtk_spin_button_map (GtkWidget *widget) static void gtk_spin_button_unmap (GtkWidget *widget) { - g_return_if_fail (GTK_IS_SPIN_BUTTON (widget)); - if (GTK_WIDGET_MAPPED (widget)) { gdk_window_hide (GTK_SPIN_BUTTON (widget)->panel); @@ -496,8 +490,6 @@ gtk_spin_button_realize (GtkWidget *widget) gint return_val; gint arrow_size; - g_return_if_fail (GTK_IS_SPIN_BUTTON (widget)); - spin_button = GTK_SPIN_BUTTON (widget); arrow_size = spin_button_get_arrow_size (spin_button); @@ -544,11 +536,7 @@ gtk_spin_button_realize (GtkWidget *widget) static void gtk_spin_button_unrealize (GtkWidget *widget) { - GtkSpinButton *spin; - - g_return_if_fail (GTK_IS_SPIN_BUTTON (widget)); - - spin = GTK_SPIN_BUTTON (widget); + GtkSpinButton *spin = GTK_SPIN_BUTTON (widget); GTK_WIDGET_CLASS (parent_class)->unrealize (widget); @@ -591,9 +579,6 @@ gtk_spin_button_size_request (GtkWidget *widget, GtkSpinButton *spin_button; gint arrow_size; - g_return_if_fail (requisition != NULL); - g_return_if_fail (GTK_IS_SPIN_BUTTON (widget)); - entry = GTK_ENTRY (widget); spin_button = GTK_SPIN_BUTTON (widget); arrow_size = spin_button_get_arrow_size (spin_button); @@ -660,9 +645,6 @@ gtk_spin_button_size_allocate (GtkWidget *widget, GtkAllocation child_allocation; gint arrow_size; - g_return_if_fail (GTK_IS_SPIN_BUTTON (widget)); - g_return_if_fail (allocation != NULL); - spin = GTK_SPIN_BUTTON (widget); arrow_size = spin_button_get_arrow_size (spin); @@ -705,9 +687,6 @@ gtk_spin_button_expose (GtkWidget *widget, GtkSpinButton *spin; gint arrow_size; - g_return_val_if_fail (GTK_IS_SPIN_BUTTON (widget), FALSE); - g_return_val_if_fail (event != NULL, FALSE); - spin = GTK_SPIN_BUTTON (widget); arrow_size = spin_button_get_arrow_size (spin); @@ -840,12 +819,7 @@ static gint gtk_spin_button_enter_notify (GtkWidget *widget, GdkEventCrossing *event) { - GtkSpinButton *spin; - - g_return_val_if_fail (GTK_IS_SPIN_BUTTON (widget), FALSE); - g_return_val_if_fail (event != NULL, FALSE); - - spin = GTK_SPIN_BUTTON (widget); + GtkSpinButton *spin = GTK_SPIN_BUTTON (widget); if (event->window == spin->panel) { @@ -874,12 +848,7 @@ static gint gtk_spin_button_leave_notify (GtkWidget *widget, GdkEventCrossing *event) { - GtkSpinButton *spin; - - g_return_val_if_fail (GTK_IS_SPIN_BUTTON (widget), FALSE); - g_return_val_if_fail (event != NULL, FALSE); - - spin = GTK_SPIN_BUTTON (widget); + GtkSpinButton *spin = GTK_SPIN_BUTTON (widget); if (event->window == spin->panel && spin->click_child == 2) { @@ -901,9 +870,6 @@ static gint gtk_spin_button_focus_out (GtkWidget *widget, GdkEventFocus *event) { - g_return_val_if_fail (GTK_IS_SPIN_BUTTON (widget), FALSE); - g_return_val_if_fail (event != NULL, FALSE); - if (GTK_ENTRY (widget)->editable) gtk_spin_button_update (GTK_SPIN_BUTTON (widget)); @@ -930,12 +896,7 @@ static gint gtk_spin_button_scroll (GtkWidget *widget, GdkEventScroll *event) { - GtkSpinButton *spin; - - g_return_val_if_fail (GTK_IS_SPIN_BUTTON (widget), FALSE); - g_return_val_if_fail (event != NULL, FALSE); - - spin = GTK_SPIN_BUTTON (widget); + GtkSpinButton *spin = GTK_SPIN_BUTTON (widget); if (event->direction == GDK_SCROLL_UP) { @@ -956,7 +917,7 @@ gtk_spin_button_scroll (GtkWidget *widget, } static void -gtk_spin_button_stop_spinning(GtkSpinButton *spin) +gtk_spin_button_stop_spinning (GtkSpinButton *spin) { if (spin->timer) { @@ -995,12 +956,7 @@ static gint gtk_spin_button_button_press (GtkWidget *widget, GdkEventButton *event) { - GtkSpinButton *spin; - - g_return_val_if_fail (GTK_IS_SPIN_BUTTON (widget), FALSE); - g_return_val_if_fail (event != NULL, FALSE); - - spin = GTK_SPIN_BUTTON (widget); + GtkSpinButton *spin = GTK_SPIN_BUTTON (widget); if (!spin->button) { @@ -1046,9 +1002,6 @@ gtk_spin_button_button_release (GtkWidget *widget, GtkSpinButton *spin; gint arrow_size; - g_return_val_if_fail (GTK_IS_SPIN_BUTTON (widget), FALSE); - g_return_val_if_fail (event != NULL, FALSE); - spin = GTK_SPIN_BUTTON (widget); arrow_size = spin_button_get_arrow_size (spin); @@ -1100,13 +1053,8 @@ static gint gtk_spin_button_motion_notify (GtkWidget *widget, GdkEventMotion *event) { - GtkSpinButton *spin; - - g_return_val_if_fail (GTK_IS_SPIN_BUTTON (widget), FALSE); - g_return_val_if_fail (event != NULL, FALSE); + GtkSpinButton *spin = GTK_SPIN_BUTTON (widget); - spin = GTK_SPIN_BUTTON (widget); - if (spin->button) return FALSE; @@ -1187,8 +1135,6 @@ gtk_spin_button_value_changed (GtkAdjustment *adjustment, { gint return_val; - g_return_if_fail (GTK_IS_ADJUSTMENT (adjustment)); - return_val = FALSE; gtk_signal_emit (GTK_OBJECT (spin_button), spinbutton_signals[OUTPUT], &return_val); @@ -1213,9 +1159,6 @@ gtk_spin_button_key_press (GtkWidget *widget, gboolean key_repeat = FALSE; gboolean retval = FALSE; - g_return_val_if_fail (GTK_IS_SPIN_BUTTON (widget), FALSE); - g_return_val_if_fail (event != NULL, FALSE); - spin = GTK_SPIN_BUTTON (widget); key = event->keyval; @@ -1333,11 +1276,7 @@ static gint gtk_spin_button_key_release (GtkWidget *widget, GdkEventKey *event) { - GtkSpinButton *spin; - - g_return_val_if_fail (GTK_IS_SPIN_BUTTON (widget), FALSE); - - spin = GTK_SPIN_BUTTON (widget); + GtkSpinButton *spin = GTK_SPIN_BUTTON (widget); spin->ev_time = event->time; return TRUE; @@ -1464,8 +1403,6 @@ gtk_spin_button_real_spin (GtkSpinButton *spin_button, { GtkAdjustment *adj; gdouble new_value = 0.0; - - g_return_if_fail (GTK_IS_SPIN_BUTTON (spin_button)); adj = spin_button->adjustment; diff --git a/gtk/gtktearoffmenuitem.c b/gtk/gtktearoffmenuitem.c index 80ef05a8dd..fd8dd9cabf 100644 --- a/gtk/gtktearoffmenuitem.c +++ b/gtk/gtktearoffmenuitem.c @@ -131,8 +131,6 @@ gtk_tearoff_menu_item_paint (GtkWidget *widget, gint x, y; gint right_max; - g_return_if_fail (GTK_IS_TEAROFF_MENU_ITEM (widget)); - if (GTK_WIDGET_DRAWABLE (widget)) { menu_item = GTK_MENU_ITEM (widget); @@ -194,9 +192,6 @@ static gint gtk_tearoff_menu_item_expose (GtkWidget *widget, GdkEventExpose *event) { - g_return_val_if_fail (GTK_IS_TEAROFF_MENU_ITEM (widget), FALSE); - g_return_val_if_fail (event != NULL, FALSE); - gtk_tearoff_menu_item_paint (widget, &event->area); return FALSE; @@ -212,11 +207,8 @@ gtk_tearoff_menu_item_delete_cb (GtkMenuItem *menu_item, GdkEventAny *event) static void gtk_tearoff_menu_item_activate (GtkMenuItem *menu_item) { - GtkTearoffMenuItem *tearoff_menu_item; - - g_return_if_fail (GTK_IS_TEAROFF_MENU_ITEM (menu_item)); + GtkTearoffMenuItem *tearoff_menu_item = GTK_TEAROFF_MENU_ITEM (menu_item); - tearoff_menu_item = GTK_TEAROFF_MENU_ITEM (menu_item); tearoff_menu_item->torn_off = !tearoff_menu_item->torn_off; gtk_widget_queue_resize (GTK_WIDGET (menu_item)); diff --git a/gtk/gtkvbbox.c b/gtk/gtkvbbox.c index 3cda26136f..18c01e1c88 100644 --- a/gtk/gtkvbbox.c +++ b/gtk/gtkvbbox.c @@ -143,10 +143,6 @@ gtk_vbutton_box_size_request (GtkWidget *widget, gint spacing; GtkButtonBoxStyle layout; - g_return_if_fail (widget != NULL); - g_return_if_fail (GTK_IS_VBUTTON_BOX (widget)); - g_return_if_fail (requisition != NULL); - box = GTK_BOX (widget); bbox = GTK_BUTTON_BOX (widget); @@ -216,10 +212,6 @@ gtk_vbutton_box_size_allocate (GtkWidget *widget, GtkButtonBoxStyle layout; gint spacing; - g_return_if_fail (widget != NULL); - g_return_if_fail (GTK_IS_VBUTTON_BOX (widget)); - g_return_if_fail (allocation != NULL); - base_box = GTK_BOX (widget); box = GTK_BUTTON_BOX (widget); hbox = GTK_VBUTTON_BOX (widget); diff --git a/gtk/gtkvbox.c b/gtk/gtkvbox.c index 35e0e709f2..3111dc93d2 100644 --- a/gtk/gtkvbox.c +++ b/gtk/gtkvbox.c @@ -102,9 +102,6 @@ gtk_vbox_size_request (GtkWidget *widget, gint nvis_children; gint height; - g_return_if_fail (GTK_IS_VBOX (widget)); - g_return_if_fail (requisition != NULL); - box = GTK_BOX (widget); requisition->width = 0; requisition->height = 0; @@ -162,9 +159,6 @@ gtk_vbox_size_allocate (GtkWidget *widget, gint extra; gint y; - g_return_if_fail (GTK_IS_VBOX (widget)); - g_return_if_fail (allocation != NULL); - box = GTK_BOX (widget); widget->allocation = *allocation; diff --git a/gtk/gtkviewport.c b/gtk/gtkviewport.c index e875c5cc9a..43aaebea3a 100644 --- a/gtk/gtkviewport.c +++ b/gtk/gtkviewport.c @@ -466,8 +466,6 @@ gtk_viewport_realize (GtkWidget *widget) gint event_mask; gint border_width; - g_return_if_fail (GTK_IS_VIEWPORT (widget)); - border_width = GTK_CONTAINER (widget)->border_width; bin = GTK_BIN (widget); @@ -545,11 +543,7 @@ gtk_viewport_realize (GtkWidget *widget) static void gtk_viewport_unrealize (GtkWidget *widget) { - GtkViewport *viewport; - - g_return_if_fail (GTK_IS_VIEWPORT (widget)); - - viewport = GTK_VIEWPORT (widget); + GtkViewport *viewport = GTK_VIEWPORT (widget); gdk_window_set_user_data (viewport->view_window, NULL); gdk_window_destroy (viewport->view_window); @@ -590,9 +584,6 @@ gtk_viewport_expose (GtkWidget *widget, GtkBin *bin; GdkEventExpose child_event; - g_return_val_if_fail (GTK_IS_VIEWPORT (widget), FALSE); - g_return_val_if_fail (event != NULL, FALSE); - if (GTK_WIDGET_DRAWABLE (widget)) { viewport = GTK_VIEWPORT (widget); @@ -624,8 +615,7 @@ gtk_viewport_add (GtkContainer *container, { GtkBin *bin; - g_return_if_fail (GTK_IS_VIEWPORT (container)); - g_return_if_fail (child != NULL); + g_return_if_fail (GTK_IS_WIDGET (child)); bin = GTK_BIN (container); g_return_if_fail (bin->child == NULL); @@ -643,9 +633,6 @@ gtk_viewport_size_request (GtkWidget *widget, GtkBin *bin; GtkRequisition child_requisition; - g_return_if_fail (GTK_IS_VIEWPORT (widget)); - g_return_if_fail (requisition != NULL); - viewport = GTK_VIEWPORT (widget); bin = GTK_BIN (widget); @@ -788,7 +775,7 @@ gtk_viewport_adjustment_changed (GtkAdjustment *adjustment, { GtkViewport *viewport; - g_return_if_fail (adjustment != NULL); + g_return_if_fail (GTK_IS_ADJUSTMENT (adjustment)); g_return_if_fail (GTK_IS_VIEWPORT (data)); viewport = GTK_VIEWPORT (data); @@ -802,7 +789,7 @@ gtk_viewport_adjustment_value_changed (GtkAdjustment *adjustment, GtkBin *bin; GtkAllocation child_allocation; - g_return_if_fail (adjustment != NULL); + g_return_if_fail (GTK_IS_ADJUSTMENT (adjustment)); g_return_if_fail (GTK_IS_VIEWPORT (data)); viewport = GTK_VIEWPORT (data); diff --git a/gtk/gtkvruler.c b/gtk/gtkvruler.c index f3fa8b75a3..978f62345b 100644 --- a/gtk/gtkvruler.c +++ b/gtk/gtkvruler.c @@ -110,9 +110,6 @@ gtk_vruler_motion_notify (GtkWidget *widget, GtkRuler *ruler; gint y; - g_return_val_if_fail (GTK_IS_VRULER (widget), FALSE); - g_return_val_if_fail (event != NULL, FALSE); - ruler = GTK_RULER (widget); if (event->is_hint) @@ -153,8 +150,6 @@ gtk_vruler_draw_ticks (GtkRuler *ruler) PangoLayout *layout; PangoRectangle logical_rect, ink_rect; - g_return_if_fail (GTK_IS_VRULER (ruler)); - if (!GTK_WIDGET_DRAWABLE (ruler)) return; @@ -289,8 +284,6 @@ gtk_vruler_draw_pos (GtkRuler *ruler) gint ythickness; gdouble increment; - g_return_if_fail (GTK_IS_VRULER (ruler)); - if (GTK_WIDGET_DRAWABLE (ruler)) { widget = GTK_WIDGET (ruler); diff --git a/gtk/gtkvseparator.c b/gtk/gtkvseparator.c index c4a7f1e2d1..48c3962f6b 100644 --- a/gtk/gtkvseparator.c +++ b/gtk/gtkvseparator.c @@ -86,9 +86,6 @@ static gint gtk_vseparator_expose (GtkWidget *widget, GdkEventExpose *event) { - g_return_val_if_fail (GTK_IS_VSEPARATOR (widget), FALSE); - g_return_val_if_fail (event != NULL, FALSE); - if (GTK_WIDGET_DRAWABLE (widget)) gtk_paint_vline (widget->style, widget->window, GTK_STATE_NORMAL, &event->area, widget, "vseparator", diff --git a/gtk/gtkwindow.c b/gtk/gtkwindow.c index 79df74744c..23bef62604 100644 --- a/gtk/gtkwindow.c +++ b/gtk/gtkwindow.c @@ -1109,7 +1109,7 @@ gtk_window_remove_accel_group (GtkWindow *window, GtkAccelGroup *accel_group) { g_return_if_fail (GTK_IS_WINDOW (window)); - g_return_if_fail (accel_group != NULL); + g_return_if_fail (GTK_IS_ACCEL_GROUP (accel_group)); g_signal_handlers_disconnect_by_func (accel_group, G_CALLBACK (gtk_window_notify_keys_changed), @@ -1490,11 +1490,7 @@ _gtk_window_reposition (GtkWindow *window, static void gtk_window_dispose (GObject *object) { - GtkWindow *window; - - g_return_if_fail (GTK_IS_WINDOW (object)); - - window = GTK_WINDOW (object); + GtkWindow *window = GTK_WINDOW (object); gtk_window_set_focus (window, NULL); gtk_window_set_default (window, NULL); @@ -1792,7 +1788,8 @@ gtk_window_set_geometry_hints (GtkWindow *window, { GtkWindowGeometryInfo *info; - g_return_if_fail (window != NULL); + g_return_if_fail (GTK_IS_WINDOW (window)); + g_return_if_fail (geometry_widget == NULL || GTK_IS_WIDGET (geometry_widget)); info = gtk_window_get_geometry_info (window, TRUE); @@ -2254,6 +2251,8 @@ gtk_window_get_icon (GtkWindow *window) { GtkWindowIconInfo *info; + g_return_if_fail (GTK_IS_WINDOW (window)); + info = get_icon_info (window); if (info && info->icon_list) return GDK_PIXBUF (info->icon_list->data); @@ -2344,7 +2343,6 @@ gtk_window_set_default_size_internal (GtkWindow *window, { GtkWindowGeometryInfo *info; - g_return_if_fail (GTK_IS_WINDOW (window)); g_return_if_fail (change_width == FALSE || width >= -1); g_return_if_fail (change_height == FALSE || height >= -1); @@ -2887,11 +2885,7 @@ gtk_window_reshow_with_initial_size (GtkWindow *window) static void gtk_window_destroy (GtkObject *object) { - GtkWindow *window; - - g_return_if_fail (GTK_IS_WINDOW (object)); - - window = GTK_WINDOW (object); + GtkWindow *window = GTK_WINDOW (object); if (window->transient_parent) gtk_window_set_transient_for (window, NULL); @@ -2940,11 +2934,7 @@ gtk_window_mnemonic_hash_remove (gpointer key, static void gtk_window_finalize (GObject *object) { - GtkWindow *window; - - g_return_if_fail (GTK_IS_WINDOW (object)); - - window = GTK_WINDOW (object); + GtkWindow *window = GTK_WINDOW (object); toplevel_list = g_slist_remove (toplevel_list, window); @@ -3058,11 +3048,7 @@ gtk_window_show (GtkWidget *widget) static void gtk_window_hide (GtkWidget *widget) { - GtkWindow *window; - - g_return_if_fail (GTK_IS_WINDOW (widget)); - - window = GTK_WINDOW (widget); + GtkWindow *window = GTK_WINDOW (widget); GTK_WIDGET_UNSET_FLAGS (widget, GTK_VISIBLE); gtk_widget_unmap (widget); @@ -3074,15 +3060,11 @@ gtk_window_hide (GtkWidget *widget) static void gtk_window_map (GtkWidget *widget) { - GtkWindow *window; + GtkWindow *window = GTK_WINDOW (widget); GdkWindow *toplevel; - g_return_if_fail (GTK_IS_WINDOW (widget)); - GTK_WIDGET_SET_FLAGS (widget, GTK_MAPPED); - window = GTK_WINDOW (widget); - if (window->bin.child && GTK_WIDGET_VISIBLE (window->bin.child) && !GTK_WIDGET_MAPPED (window->bin.child)) @@ -3121,10 +3103,8 @@ gtk_window_map (GtkWidget *widget) static void gtk_window_unmap (GtkWidget *widget) { - GtkWindow *window; + GtkWindow *window = GTK_WINDOW (widget); GtkWindowGeometryInfo *info; - - window = GTK_WINDOW (widget); GTK_WIDGET_UNSET_FLAGS (widget, GTK_MAPPED); if (window->frame) @@ -3157,8 +3137,6 @@ gtk_window_realize (GtkWidget *widget) GdkWindowAttr attributes; gint attributes_mask; - g_return_if_fail (GTK_IS_WINDOW (widget)); - window = GTK_WINDOW (widget); /* ensure widget tree is properly size allocated */ @@ -3336,9 +3314,6 @@ gtk_window_size_request (GtkWidget *widget, GtkWindow *window; GtkBin *bin; - g_return_if_fail (GTK_IS_WINDOW (widget)); - g_return_if_fail (requisition != NULL); - window = GTK_WINDOW (widget); bin = GTK_BIN (window); @@ -3363,9 +3338,6 @@ gtk_window_size_allocate (GtkWidget *widget, GtkWindow *window; GtkAllocation child_allocation; - g_return_if_fail (GTK_IS_WINDOW (widget)); - g_return_if_fail (allocation != NULL); - window = GTK_WINDOW (widget); widget->allocation = *allocation; @@ -3395,10 +3367,6 @@ gtk_window_event (GtkWidget *widget, GdkEvent *event) GtkWindow *window; gboolean return_val; - - g_return_val_if_fail (GTK_IS_WINDOW (widget), FALSE); - g_return_val_if_fail (event != NULL, FALSE); - window = GTK_WINDOW (widget); if (window->frame && (event->any.window == window->frame)) @@ -3456,12 +3424,7 @@ static gint gtk_window_configure_event (GtkWidget *widget, GdkEventConfigure *event) { - GtkWindow *window; - - g_return_val_if_fail (GTK_IS_WINDOW (widget), FALSE); - g_return_val_if_fail (event != NULL, FALSE); - - window = GTK_WINDOW (widget); + GtkWindow *window = GTK_WINDOW (widget); /* window->configure_request_count incremented for each * configure request, and decremented to a min of 0 for @@ -3559,9 +3522,6 @@ gtk_window_key_press_event (GtkWidget *widget, GtkWidget *focus; gboolean handled; - g_return_val_if_fail (GTK_IS_WINDOW (widget), FALSE); - g_return_val_if_fail (event != NULL, FALSE); - window = GTK_WINDOW (widget); handled = FALSE; @@ -3616,9 +3576,6 @@ gtk_window_key_release_event (GtkWidget *widget, GtkWindow *window; gint handled; - g_return_val_if_fail (GTK_IS_WINDOW (widget), FALSE); - g_return_val_if_fail (event != NULL, FALSE); - window = GTK_WINDOW (widget); handled = FALSE; if (window->focus_widget && @@ -3660,9 +3617,6 @@ static gint gtk_window_enter_notify_event (GtkWidget *widget, GdkEventCrossing *event) { - g_return_val_if_fail (GTK_IS_WINDOW (widget), FALSE); - g_return_val_if_fail (event != NULL, FALSE); - return FALSE; } @@ -3670,9 +3624,6 @@ static gint gtk_window_leave_notify_event (GtkWidget *widget, GdkEventCrossing *event) { - g_return_val_if_fail (GTK_IS_WINDOW (widget), FALSE); - g_return_val_if_fail (event != NULL, FALSE); - return FALSE; } @@ -3764,9 +3715,6 @@ static gint gtk_window_client_event (GtkWidget *widget, GdkEventClient *event) { - g_return_val_if_fail (GTK_IS_WINDOW (widget), FALSE); - g_return_val_if_fail (event != NULL, FALSE); - if (!atom_rcfiles) atom_rcfiles = gdk_atom_intern ("_GTK_READ_RCFILES", FALSE); @@ -3779,11 +3727,7 @@ gtk_window_client_event (GtkWidget *widget, static void gtk_window_check_resize (GtkContainer *container) { - GtkWindow *window; - - g_return_if_fail (GTK_IS_WINDOW (container)); - - window = GTK_WINDOW (container); + GtkWindow *window = GTK_WINDOW (container); if (GTK_WIDGET_VISIBLE (container)) gtk_window_move_resize (window); @@ -3845,8 +3789,6 @@ gtk_window_real_set_focus (GtkWindow *window, GdkEventFocus event; gboolean def_flags = 0; - g_return_if_fail (GTK_IS_WINDOW (window)); - if (window->default_widget) def_flags = GTK_WIDGET_HAS_DEFAULT (window->default_widget); @@ -4591,8 +4533,6 @@ gtk_window_compute_hints (GtkWindow *window, GtkWindowGeometryInfo *geometry_info; GtkRequisition requisition; - g_return_if_fail (GTK_IS_WINDOW (window)); - widget = GTK_WIDGET (window); gtk_widget_get_child_requisition (widget, &requisition); @@ -4710,9 +4650,6 @@ static gint gtk_window_expose (GtkWidget *widget, GdkEventExpose *event) { - g_return_val_if_fail (GTK_IS_WINDOW (widget), FALSE); - g_return_val_if_fail (event != NULL, FALSE); - if (!GTK_WIDGET_APP_PAINTABLE (widget)) gtk_window_paint (widget, &event->area); @@ -4793,10 +4730,12 @@ gtk_window_set_frame_dimensions (GtkWindow *window, gint right, gint bottom) { - GtkWidget *widget = GTK_WIDGET (window); + GtkWidget *widget; g_return_if_fail (GTK_IS_WINDOW (window)); + widget = GTK_WIDGET (window); + if (window->frame_left == left && window->frame_top == top && window->frame_right == right && |