[gtk] cssanimatedstyle: Avoid some type checks and unnecessary work



commit df1f036a95c41a8aa867e92c8fb4d5b7e566223b
Author: Timm Bäder <mail baedert org>
Date:   Sat Jan 19 18:05:13 2019 +0100

    cssanimatedstyle: Avoid some type checks and unnecessary work

 gtk/gtkcssanimatedstyle.c | 10 +++++-----
 gtk/gtkcsscolorvalue.c    |  1 -
 gtk/gtkcssstaticstyle.c   |  3 ---
 3 files changed, 5 insertions(+), 9 deletions(-)
---
diff --git a/gtk/gtkcssanimatedstyle.c b/gtk/gtkcssanimatedstyle.c
index 0dcd16c029..54dfa3684a 100644
--- a/gtk/gtkcssanimatedstyle.c
+++ b/gtk/gtkcssanimatedstyle.c
@@ -186,14 +186,13 @@ transition_info_add (TransitionInfo    infos[GTK_CSS_PROPERTY_N_PROPERTIES],
                      GtkStyleProperty *property,
                      guint             index)
 {
-  gtk_internal_return_if_fail (GTK_IS_STYLE_PROPERTY (property));
-
   if (GTK_IS_CSS_SHORTHAND_PROPERTY (property))
     {
-      GtkCssShorthandProperty *shorthand = GTK_CSS_SHORTHAND_PROPERTY (property);
+      GtkCssShorthandProperty *shorthand = (GtkCssShorthandProperty *) property;
+      guint len = _gtk_css_shorthand_property_get_n_subproperties (shorthand);
       guint i;
 
-      for (i = 0; i < _gtk_css_shorthand_property_get_n_subproperties (shorthand); i++)
+      for (i = 0; i < len; i++)
         {
           GtkCssStyleProperty *prop = _gtk_css_shorthand_property_get_subproperty (shorthand, i);
 
@@ -228,9 +227,10 @@ transition_infos_set (TransitionInfo  infos[GTK_CSS_PROPERTY_N_PROPERTIES],
       prop_value = _gtk_css_array_value_get_nth (transitions, i);
       if (g_ascii_strcasecmp (_gtk_css_ident_value_get (prop_value), "all") == 0)
         {
+          const guint len = _gtk_css_style_property_get_n_properties ();
           guint j;
 
-          for (j = 0; j < _gtk_css_style_property_get_n_properties (); j++)
+          for (j = 0; j < len; j++)
             {
               property = GTK_STYLE_PROPERTY (_gtk_css_style_property_lookup_by_id (j));
               transition_info_add (infos, property, i);
diff --git a/gtk/gtkcsscolorvalue.c b/gtk/gtkcsscolorvalue.c
index a98f142d54..7f39810e13 100644
--- a/gtk/gtkcsscolorvalue.c
+++ b/gtk/gtkcsscolorvalue.c
@@ -151,7 +151,6 @@ _gtk_css_color_value_resolve (GtkCssValue      *color,
   GtkCssValue *value;
 
   gtk_internal_return_val_if_fail (color != NULL, NULL);
-  gtk_internal_return_val_if_fail (provider == NULL || GTK_IS_STYLE_PROVIDER (provider), NULL);
 
   switch (color->type)
     {
diff --git a/gtk/gtkcssstaticstyle.c b/gtk/gtkcssstaticstyle.c
index a87b409761..e257296fd0 100644
--- a/gtk/gtkcssstaticstyle.c
+++ b/gtk/gtkcssstaticstyle.c
@@ -207,9 +207,6 @@ gtk_css_static_style_compute_value (GtkCssStaticStyle *style,
 {
   GtkCssValue *value;
 
-  gtk_internal_return_if_fail (GTK_IS_CSS_STATIC_STYLE (style));
-  gtk_internal_return_if_fail (GTK_IS_STYLE_PROVIDER (provider));
-  gtk_internal_return_if_fail (parent_style == NULL || GTK_IS_CSS_STYLE (parent_style));
   gtk_internal_return_if_fail (id < GTK_CSS_PROPERTY_N_PROPERTIES);
 
   /* http://www.w3.org/TR/css3-cascade/#cascade


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