Commit 321db896 authored by Matthias Clasen's avatar Matthias Clasen

Remove excessive g_return_if_fail() calls. (#57615)

        * gtk/gtkentry.c, gtk/gtkwidget.c: Remove excessive
        g_return_if_fail() calls. (#57615)
parent d67b5ce0
2002-01-23 Matthias Clasen <matthiasc@poet.de>
* gtk/gtkentry.c, gtk/gtkwidget.c: Remove excessive
g_return_if_fail() calls. (#57615)
* gtk/gtkitemfactory.c (gtk_item_factory_delete_entries): Make
it work for paths with underline accelerators. (#69247)
......
2002-01-23 Matthias Clasen <matthiasc@poet.de>
* gtk/gtkentry.c, gtk/gtkwidget.c: Remove excessive
g_return_if_fail() calls. (#57615)
* gtk/gtkitemfactory.c (gtk_item_factory_delete_entries): Make
it work for paths with underline accelerators. (#69247)
......
2002-01-23 Matthias Clasen <matthiasc@poet.de>
* gtk/gtkentry.c, gtk/gtkwidget.c: Remove excessive
g_return_if_fail() calls. (#57615)
* gtk/gtkitemfactory.c (gtk_item_factory_delete_entries): Make
it work for paths with underline accelerators. (#69247)
......
2002-01-23 Matthias Clasen <matthiasc@poet.de>
* gtk/gtkentry.c, gtk/gtkwidget.c: Remove excessive
g_return_if_fail() calls. (#57615)
* gtk/gtkitemfactory.c (gtk_item_factory_delete_entries): Make
it work for paths with underline accelerators. (#69247)
......
2002-01-23 Matthias Clasen <matthiasc@poet.de>
* gtk/gtkentry.c, gtk/gtkwidget.c: Remove excessive
g_return_if_fail() calls. (#57615)
* gtk/gtkitemfactory.c (gtk_item_factory_delete_entries): Make
it work for paths with underline accelerators. (#69247)
......
2002-01-23 Matthias Clasen <matthiasc@poet.de>
* gtk/gtkentry.c, gtk/gtkwidget.c: Remove excessive
g_return_if_fail() calls. (#57615)
* gtk/gtkitemfactory.c (gtk_item_factory_delete_entries): Make
it work for paths with underline accelerators. (#69247)
......
2002-01-23 Matthias Clasen <matthiasc@poet.de>
* gtk/gtkentry.c, gtk/gtkwidget.c: Remove excessive
g_return_if_fail() calls. (#57615)
* gtk/gtkitemfactory.c (gtk_item_factory_delete_entries): Make
it work for paths with underline accelerators. (#69247)
......
......@@ -866,9 +866,7 @@ gtk_entry_get_property (GObject *object,
GValue *value,
GParamSpec *pspec)
{
GtkEntry *entry;
entry = GTK_ENTRY (object);
GtkEntry *entry = GTK_ENTRY (object);
switch (prop_id)
{
......@@ -953,11 +951,7 @@ gtk_entry_init (GtkEntry *entry)
static void
gtk_entry_finalize (GObject *object)
{
GtkEntry *entry;
g_return_if_fail (GTK_IS_ENTRY (object));
entry = GTK_ENTRY (object);
GtkEntry *entry = GTK_ENTRY (object);
if (entry->cached_layout)
g_object_unref (G_OBJECT (entry->cached_layout));
......@@ -1004,8 +998,6 @@ gtk_entry_realize (GtkWidget *widget)
GdkWindowAttr attributes;
gint attributes_mask;
g_return_if_fail (GTK_IS_ENTRY (widget));
GTK_WIDGET_SET_FLAGS (widget, GTK_REALIZED);
entry = GTK_ENTRY (widget);
editable = GTK_EDITABLE (widget);
......@@ -1058,11 +1050,7 @@ gtk_entry_realize (GtkWidget *widget)
static void
gtk_entry_unrealize (GtkWidget *widget)
{
GtkEntry *entry;
g_return_if_fail (GTK_IS_ENTRY (widget));
entry = GTK_ENTRY (widget);
GtkEntry *entry = GTK_ENTRY (widget);
gtk_im_context_set_client_window (entry->im_context, entry->text_area);
......@@ -1094,12 +1082,10 @@ get_borders (GtkEntry *entry,
gint *xborder,
gint *yborder)
{
GtkWidget *widget;
GtkWidget *widget = GTK_WIDGET (entry);
gint focus_width;
gboolean interior_focus;
widget = GTK_WIDGET (entry);
gtk_widget_style_get (widget,
"interior-focus", &interior_focus,
"focus-line-width", &focus_width,
......@@ -1127,16 +1113,11 @@ static void
gtk_entry_size_request (GtkWidget *widget,
GtkRequisition *requisition)
{
GtkEntry *entry;
GtkEntry *entry = GTK_ENTRY (widget);
PangoFontMetrics *metrics;
gint xborder, yborder;
PangoContext *context;
g_return_if_fail (GTK_IS_ENTRY (widget));
g_return_if_fail (requisition != NULL);
entry = GTK_ENTRY (widget);
context = gtk_widget_get_pango_context (widget);
metrics = pango_context_get_metrics (context,
widget->style->font_desc,
......@@ -1172,9 +1153,7 @@ get_text_area_size (GtkEntry *entry,
{
gint xborder, yborder;
GtkRequisition requisition;
GtkWidget *widget;
widget = GTK_WIDGET (entry);
GtkWidget *widget = GTK_WIDGET (entry);
gtk_widget_get_child_requisition (widget, &requisition);
......@@ -1201,9 +1180,7 @@ get_widget_window_size (GtkEntry *entry,
gint *height)
{
GtkRequisition requisition;
GtkWidget *widget;
widget = GTK_WIDGET (entry);
GtkWidget *widget = GTK_WIDGET (entry);
gtk_widget_get_child_requisition (widget, &requisition);
......@@ -1234,15 +1211,9 @@ static void
gtk_entry_size_allocate (GtkWidget *widget,
GtkAllocation *allocation)
{
GtkEntry *entry;
GtkEditable *editable;
GtkEntry *entry = GTK_ENTRY (widget);
g_return_if_fail (GTK_IS_ENTRY (widget));
g_return_if_fail (allocation != NULL);
widget->allocation = *allocation;
entry = GTK_ENTRY (widget);
editable = GTK_EDITABLE (widget);
if (GTK_WIDGET_REALIZED (widget))
{
......@@ -1332,9 +1303,6 @@ gtk_entry_button_press (GtkWidget *widget,
gint tmp_pos;
gint sel_start, sel_end;
entry = GTK_ENTRY (widget);
editable = GTK_EDITABLE (widget);
if (event->window != entry->text_area ||
(entry->button && event->button != entry->button))
return FALSE;
......@@ -1654,8 +1622,6 @@ static void
gtk_entry_state_changed (GtkWidget *widget,
GtkStateType previous_state)
{
g_return_if_fail (GTK_IS_ENTRY (widget));
if (GTK_WIDGET_REALIZED (widget))
{
gdk_window_set_background (widget->window, &widget->style->base[GTK_WIDGET_STATE (widget)]);
......@@ -1728,13 +1694,9 @@ gtk_entry_get_chars (GtkEditable *editable,
gint start_pos,
gint end_pos)
{
GtkEntry *entry;
GtkEntry *entry = GTK_ENTRY (editable);
gint start_index, end_index;
g_return_val_if_fail (GTK_IS_ENTRY (editable), NULL);
entry = GTK_ENTRY (editable);
if (end_pos < 0)
end_pos = entry->text_length;
......@@ -2614,8 +2576,6 @@ gtk_entry_draw_text (GtkEntry *entry)
GtkWidget *widget;
PangoLayoutLine *line;
g_return_if_fail (GTK_IS_ENTRY (entry));
if (!entry->visible && entry->invisible_char == 0)
return;
......@@ -2705,8 +2665,6 @@ gtk_entry_draw_cursor (GtkEntry *entry,
GTK_TEXT_DIR_LTR : GTK_TEXT_DIR_RTL;
GtkTextDirection widget_direction = gtk_widget_get_direction (GTK_WIDGET (entry));
g_return_if_fail (GTK_IS_ENTRY (entry));
if (GTK_WIDGET_DRAWABLE (entry))
{
GtkWidget *widget = GTK_WIDGET (entry);
......@@ -2775,8 +2733,6 @@ gtk_entry_draw_cursor (GtkEntry *entry,
static void
gtk_entry_queue_draw (GtkEntry *entry)
{
g_return_if_fail (GTK_IS_ENTRY (entry));
if (GTK_WIDGET_REALIZED (entry))
gdk_window_invalidate_rect (entry->text_area, NULL, FALSE);
}
......@@ -2859,7 +2815,6 @@ gtk_entry_get_cursor_locations (GtkEntry *entry,
static void
gtk_entry_adjust_scroll (GtkEntry *entry)
{
GtkWidget *widget;
gint min_offset, max_offset;
gint text_area_width;
gint strong_x, weak_x;
......@@ -2868,10 +2823,6 @@ gtk_entry_adjust_scroll (GtkEntry *entry)
PangoLayoutLine *line;
PangoRectangle logical_rect;
g_return_if_fail (GTK_IS_ENTRY (entry));
widget = GTK_WIDGET (entry);
if (!GTK_WIDGET_REALIZED (entry))
return;
......@@ -2885,7 +2836,7 @@ gtk_entry_adjust_scroll (GtkEntry *entry)
/* Display as much text as we can */
if (gtk_widget_get_direction (widget) == GTK_TEXT_DIR_LTR)
if (gtk_widget_get_direction (GTK_WIDGET (entry)) == GTK_TEXT_DIR_LTR)
{
min_offset = 0;
max_offset = MAX (min_offset, logical_rect.width / PANGO_SCALE - text_area_width);
......@@ -3284,17 +3235,13 @@ gtk_entry_set_text (GtkEntry *entry,
{
gint tmp_pos;
GtkEditable *editable;
g_return_if_fail (GTK_IS_ENTRY (entry));
g_return_if_fail (text != NULL);
editable = GTK_EDITABLE (entry);
gtk_editable_delete_text (GTK_EDITABLE(entry), 0, -1);
gtk_editable_delete_text (GTK_EDITABLE (entry), 0, -1);
tmp_pos = 0;
gtk_editable_insert_text (editable, text, strlen (text), &tmp_pos);
gtk_editable_insert_text (GTK_EDITABLE (editable), text, strlen (text), &tmp_pos);
}
void
......@@ -3307,7 +3254,7 @@ gtk_entry_append_text (GtkEntry *entry,
g_return_if_fail (text != NULL);
tmp_pos = entry->text_length;
gtk_editable_insert_text (GTK_EDITABLE(entry), text, -1, &tmp_pos);
gtk_editable_insert_text (GTK_EDITABLE (entry), text, -1, &tmp_pos);
}
void
......@@ -3320,7 +3267,7 @@ gtk_entry_prepend_text (GtkEntry *entry,
g_return_if_fail (text != NULL);
tmp_pos = 0;
gtk_editable_insert_text (GTK_EDITABLE(entry), text, -1, &tmp_pos);
gtk_editable_insert_text (GTK_EDITABLE (entry), text, -1, &tmp_pos);
}
void
......@@ -3438,7 +3385,7 @@ gtk_entry_set_max_length (GtkEntry *entry,
g_return_if_fail (GTK_IS_ENTRY (entry));
if (max > 0 && entry->text_length > max)
gtk_editable_delete_text (GTK_EDITABLE(entry), max, -1);
gtk_editable_delete_text (GTK_EDITABLE (entry), max, -1);
entry->text_max_length = max;
g_object_notify (G_OBJECT (entry), "max_length");
......@@ -3544,6 +3491,8 @@ gtk_entry_set_width_chars (GtkEntry *entry,
gint
gtk_entry_get_width_chars (GtkEntry *entry)
{
g_return_val_if_fail (GTK_IS_ENTRY (entry), 0);
return entry->width_chars;
}
......@@ -3741,7 +3690,6 @@ static gboolean
gtk_entry_mnemonic_activate (GtkWidget *widget,
gboolean group_cycling)
{
gtk_widget_grab_focus (widget);
return TRUE;
}
......@@ -3779,13 +3727,10 @@ popup_position_func (GtkMenu *menu,
gboolean *push_in,
gpointer user_data)
{
GtkEntry *entry;
GtkWidget *widget;
GtkEntry *entry = GTK_ENTRY (user_data);
GtkWidget *widget = GTK_WIDGET (entry);
GtkRequisition req;
entry = GTK_ENTRY (user_data);
widget = GTK_WIDGET (entry);
g_return_if_fail (GTK_WIDGET_REALIZED (entry));
gdk_window_get_origin (widget->window, x, y);
......@@ -3938,9 +3883,7 @@ gtk_entry_drag_leave (GtkWidget *widget,
GdkDragContext *context,
guint time)
{
GtkEntry *entry;
entry = GTK_ENTRY (widget);
GtkEntry *entry = GTK_ENTRY (widget);
entry->dnd_position = -1;
gtk_widget_queue_draw (widget);
......@@ -3953,11 +3896,9 @@ gtk_entry_drag_drop (GtkWidget *widget,
gint y,
guint time)
{
GtkEntry *entry;
GtkEntry *entry = GTK_ENTRY (widget);
GdkAtom target = GDK_NONE;
entry = GTK_ENTRY (widget);
if (entry->editable)
target = gtk_drag_dest_find_target (widget, context, NULL);
......@@ -3976,14 +3917,12 @@ gtk_entry_drag_motion (GtkWidget *widget,
gint y,
guint time)
{
GtkEntry *entry;
GtkEntry *entry = GTK_ENTRY (widget);
GtkWidget *source_widget;
GdkDragAction suggested_action;
gint new_position, old_position;
gint sel1, sel2;
entry = GTK_ENTRY (widget);
x -= widget->style->xthickness;
y -= widget->style->ythickness;
......@@ -4041,13 +3980,10 @@ gtk_entry_drag_data_received (GtkWidget *widget,
guint info,
guint time)
{
GtkEntry *entry;
GtkEditable *editable;
GtkEntry *entry = GTK_ENTRY (widget);
GtkEditable *editable = GTK_EDITABLE (widget);
gchar *str;
entry = GTK_ENTRY (widget);
editable = GTK_EDITABLE (widget);
str = gtk_selection_data_get_text (selection_data);
if (str && entry->editable)
......
......@@ -1081,9 +1081,7 @@ gtk_widget_set_property (GObject *object,
const GValue *value,
GParamSpec *pspec)
{
GtkWidget *widget;
widget = GTK_WIDGET (object);
GtkWidget *widget = GTK_WIDGET (object);
switch (prop_id)
{
......@@ -1166,9 +1164,7 @@ gtk_widget_get_property (GObject *object,
GValue *value,
GParamSpec *pspec)
{
GtkWidget *widget;
widget = GTK_WIDGET (object);
GtkWidget *widget = GTK_WIDGET (object);
switch (prop_id)
{
......@@ -1628,8 +1624,6 @@ gtk_widget_show (GtkWidget *widget)
static void
gtk_widget_real_show (GtkWidget *widget)
{
g_return_if_fail (GTK_IS_WIDGET (widget));
if (!GTK_WIDGET_VISIBLE (widget))
{
GTK_WIDGET_SET_FLAGS (widget, GTK_VISIBLE);
......@@ -1709,8 +1703,6 @@ gtk_widget_hide (GtkWidget *widget)
static void
gtk_widget_real_hide (GtkWidget *widget)
{
g_return_if_fail (GTK_IS_WIDGET (widget));
if (GTK_WIDGET_VISIBLE (widget))
{
GTK_WIDGET_UNSET_FLAGS (widget, GTK_VISIBLE);
......@@ -2513,8 +2505,6 @@ static void
gtk_widget_real_size_allocate (GtkWidget *widget,
GtkAllocation *allocation)
{
g_return_if_fail (GTK_IS_WIDGET (widget));
widget->allocation = *allocation;
if (GTK_WIDGET_REALIZED (widget) &&
......@@ -2845,9 +2835,6 @@ gtk_widget_real_key_press_event (GtkWidget *widget,
{
gboolean handled = FALSE;
g_return_val_if_fail (GTK_IS_WIDGET (widget), handled);
g_return_val_if_fail (event != NULL, handled);
if (!handled)
handled = gtk_bindings_activate (GTK_OBJECT (widget),
event->keyval,
......@@ -2862,9 +2849,6 @@ gtk_widget_real_key_release_event (GtkWidget *widget,
{
gboolean handled = FALSE;
g_return_val_if_fail (GTK_IS_WIDGET (widget), handled);
g_return_val_if_fail (event != NULL, handled);
if (!handled)
handled = gtk_bindings_activate (GTK_OBJECT (widget),
event->keyval,
......@@ -3153,7 +3137,6 @@ static void
gtk_widget_reparent_container_child (GtkWidget *widget,
gpointer client_data)
{
g_return_if_fail (GTK_IS_WIDGET (widget));
g_return_if_fail (client_data != NULL);
if (GTK_WIDGET_NO_WINDOW (widget))
......@@ -3330,8 +3313,6 @@ reset_focus_recurse (GtkWidget *widget,
static void
gtk_widget_real_grab_focus (GtkWidget *focus_widget)
{
g_return_if_fail (GTK_IS_WIDGET (focus_widget));
if (GTK_WIDGET_CAN_FOCUS (focus_widget))
{
GtkWidget *toplevel;
......@@ -3904,6 +3885,7 @@ gtk_widget_modify_style (GtkWidget *widget,
{
GtkRcStyle *old_style;
g_return_if_fail (GTK_IS_WIDGET (widget));
g_return_if_fail (GTK_IS_RC_STYLE (style));
old_style = gtk_object_get_data_by_id (GTK_OBJECT (widget),
......@@ -3948,6 +3930,8 @@ gtk_widget_get_modifier_style (GtkWidget *widget)
{
GtkRcStyle *rc_style;
g_return_val_if_fail (GTK_IS_WIDGET (widget), NULL);
rc_style = gtk_object_get_data_by_id (GTK_OBJECT (widget),
quark_rc_style);
......@@ -4134,9 +4118,6 @@ gtk_widget_set_style_internal (GtkWidget *widget,
GtkStyle *style,
gboolean initial_emission)
{
g_return_if_fail (GTK_IS_WIDGET (widget));
g_return_if_fail (style != NULL);
g_object_ref (G_OBJECT (widget));
g_object_freeze_notify (G_OBJECT (widget));
......@@ -5333,7 +5314,7 @@ gtk_widget_pop_composite_child (void)
void
gtk_widget_push_colormap (GdkColormap *cmap)
{
g_return_if_fail (cmap != NULL);
g_return_if_fail (GDK_IS_COLORMAP (cmap));
colormap_stack = g_slist_prepend (colormap_stack, cmap);
}
......@@ -5363,6 +5344,8 @@ gtk_widget_pop_colormap (void)
void
gtk_widget_set_default_colormap (GdkColormap *colormap)
{
g_return_if_fail (GDK_IS_COLORMAP (colormap));
if (default_colormap != colormap)
{
if (default_colormap)
......@@ -5566,11 +5549,8 @@ gtk_widget_dispose (GObject *object)
static void
gtk_widget_real_destroy (GtkObject *object)
{
GtkWidget *widget;
/* gtk_object_destroy() will already hold a refcount on object
*/
widget = GTK_WIDGET (object);
/* gtk_object_destroy() will already hold a refcount on object */
GtkWidget *widget = GTK_WIDGET (object);
/* wipe accelerator closures (keep order) */
g_object_set_qdata (G_OBJECT (widget), quark_accel_path, NULL);
......@@ -5632,7 +5612,6 @@ gtk_widget_finalize (GObject *object)
static void
gtk_widget_real_map (GtkWidget *widget)
{
g_return_if_fail (GTK_IS_WIDGET (widget));
g_return_if_fail (GTK_WIDGET_REALIZED (widget) == TRUE);
if (!GTK_WIDGET_MAPPED (widget))
......@@ -5655,8 +5634,6 @@ gtk_widget_real_map (GtkWidget *widget)
static void
gtk_widget_real_unmap (GtkWidget *widget)
{
g_return_if_fail (GTK_IS_WIDGET (widget));
if (GTK_WIDGET_MAPPED (widget))
{
GTK_WIDGET_UNSET_FLAGS (widget, GTK_MAPPED);
......@@ -5677,7 +5654,6 @@ gtk_widget_real_unmap (GtkWidget *widget)
static void
gtk_widget_real_realize (GtkWidget *widget)
{
g_return_if_fail (GTK_IS_WIDGET (widget));
g_return_if_fail (GTK_WIDGET_NO_WINDOW (widget));
GTK_WIDGET_SET_FLAGS (widget, GTK_REALIZED);
......@@ -5700,8 +5676,6 @@ gtk_widget_real_realize (GtkWidget *widget)
static void
gtk_widget_real_unrealize (GtkWidget *widget)
{
g_return_if_fail (GTK_IS_WIDGET (widget));
if (GTK_WIDGET_MAPPED (widget))
gtk_widget_real_unmap (widget);
......@@ -5743,8 +5717,6 @@ static void
gtk_widget_real_size_request (GtkWidget *widget,
GtkRequisition *requisition)
{
g_return_if_fail (GTK_IS_WIDGET (widget));
requisition->width = widget->requisition.width;
requisition->height = widget->requisition.height;
}
......@@ -5892,8 +5864,6 @@ _gtk_widget_get_aux_info (GtkWidget *widget,
static void
gtk_widget_aux_info_destroy (GtkWidgetAuxInfo *aux_info)
{
g_return_if_fail (aux_info != NULL);
g_mem_chunk_free (aux_info_mem_chunk, aux_info);
}
......
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