[gtk+/native-layout] widget: don't check before setting to avoid costly type checks
- From: Tristan Van Berkom <tvb src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gtk+/native-layout] widget: don't check before setting to avoid costly type checks
- Date: Sun, 4 Apr 2010 02:27:21 +0000 (UTC)
commit 100c6dc513b90b35f17dc3abafc2ab8736ac20b7
Author: Stefan Kost <ensonic users sf net>
Date: Thu Feb 11 10:38:44 2010 +0200
widget: don't check before setting to avoid costly type checks
There are no side effect of setting these flags and we don't fire g_object
notifies also. Thus set/unset right away without costly check of current state.
gtk/gtkwidget.c | 26 ++++++++------------------
1 files changed, 8 insertions(+), 18 deletions(-)
---
diff --git a/gtk/gtkwidget.c b/gtk/gtkwidget.c
index a9674f7..1efc668 100644
--- a/gtk/gtkwidget.c
+++ b/gtk/gtkwidget.c
@@ -6001,15 +6001,10 @@ gtk_widget_set_realized (GtkWidget *widget,
{
g_return_if_fail (GTK_IS_WIDGET (widget));
- realized = realized != FALSE;
-
- if (realized != gtk_widget_get_realized (widget))
- {
- if (realized)
- GTK_WIDGET_SET_FLAGS (widget, GTK_REALIZED);
- else
- GTK_WIDGET_UNSET_FLAGS (widget, GTK_REALIZED);
- }
+ if (realized)
+ GTK_WIDGET_SET_FLAGS (widget, GTK_REALIZED);
+ else
+ GTK_WIDGET_UNSET_FLAGS (widget, GTK_REALIZED);
}
/**
@@ -6048,15 +6043,10 @@ gtk_widget_set_mapped (GtkWidget *widget,
{
g_return_if_fail (GTK_IS_WIDGET (widget));
- mapped = mapped != FALSE;
-
- if (mapped != gtk_widget_get_mapped (widget))
- {
- if (mapped)
- GTK_WIDGET_SET_FLAGS (widget, GTK_MAPPED);
- else
- GTK_WIDGET_UNSET_FLAGS (widget, GTK_MAPPED);
- }
+ if (mapped)
+ GTK_WIDGET_SET_FLAGS (widget, GTK_MAPPED);
+ else
+ GTK_WIDGET_UNSET_FLAGS (widget, GTK_MAPPED);
}
/**
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]