[gtk/wip/otte/boxes: 19/20] css: Mark some hot functions as G_GNUC_PURE



commit 59c40e4b93e65e39ac6098d99b26e921f4bc5cda
Author: Benjamin Otte <otte redhat com>
Date:   Fri Feb 15 04:06:22 2019 +0100

    css: Mark some hot functions as G_GNUC_PURE
    
    By doing that, gcc will generate code that avoids calling these
    functions when not needed.

 gtk/gtkcssnodeprivate.h        | 30 +++++++++++++++---------------
 gtk/gtkcssnumbervalueprivate.h |  6 +++---
 gtk/gtkcssrgbavalueprivate.h   |  2 +-
 gtk/gtkcssstyleprivate.h       |  6 +++---
 4 files changed, 22 insertions(+), 22 deletions(-)
---
diff --git a/gtk/gtkcssnodeprivate.h b/gtk/gtkcssnodeprivate.h
index 8c71733192..7335fb30da 100644
--- a/gtk/gtkcssnodeprivate.h
+++ b/gtk/gtkcssnodeprivate.h
@@ -106,28 +106,28 @@ void                    gtk_css_node_insert_before      (GtkCssNode            *
                                                          GtkCssNode            *cssnode,
                                                          GtkCssNode            *next_sibling);
 
-GtkCssNode *            gtk_css_node_get_parent         (GtkCssNode            *cssnode);
-GtkCssNode *            gtk_css_node_get_first_child    (GtkCssNode            *cssnode);
-GtkCssNode *            gtk_css_node_get_last_child     (GtkCssNode            *cssnode);
-GtkCssNode *            gtk_css_node_get_previous_sibling(GtkCssNode           *cssnode);
-GtkCssNode *            gtk_css_node_get_next_sibling   (GtkCssNode            *cssnode);
+GtkCssNode *            gtk_css_node_get_parent         (GtkCssNode            *cssnode) G_GNUC_PURE;
+GtkCssNode *            gtk_css_node_get_first_child    (GtkCssNode            *cssnode) G_GNUC_PURE;
+GtkCssNode *            gtk_css_node_get_last_child     (GtkCssNode            *cssnode) G_GNUC_PURE;
+GtkCssNode *            gtk_css_node_get_previous_sibling(GtkCssNode           *cssnode) G_GNUC_PURE;
+GtkCssNode *            gtk_css_node_get_next_sibling   (GtkCssNode            *cssnode) G_GNUC_PURE;
 
 void                    gtk_css_node_set_visible        (GtkCssNode            *cssnode,
                                                          gboolean               visible);
-gboolean                gtk_css_node_get_visible        (GtkCssNode            *cssnode);
+gboolean                gtk_css_node_get_visible        (GtkCssNode            *cssnode) G_GNUC_PURE;
 
 void                    gtk_css_node_set_name           (GtkCssNode            *cssnode,
                                                          /*interned*/const char*name);
-/*interned*/const char *gtk_css_node_get_name           (GtkCssNode            *cssnode);
+/*interned*/const char *gtk_css_node_get_name           (GtkCssNode            *cssnode) G_GNUC_PURE;
 void                    gtk_css_node_set_widget_type    (GtkCssNode            *cssnode,
                                                          GType                  widget_type);
-GType                   gtk_css_node_get_widget_type    (GtkCssNode            *cssnode);
+GType                   gtk_css_node_get_widget_type    (GtkCssNode            *cssnode) G_GNUC_PURE;
 void                    gtk_css_node_set_id             (GtkCssNode            *cssnode,
                                                          /*interned*/const char*id);
-/*interned*/const char *gtk_css_node_get_id             (GtkCssNode            *cssnode);
+/*interned*/const char *gtk_css_node_get_id             (GtkCssNode            *cssnode) G_GNUC_PURE;
 void                    gtk_css_node_set_state          (GtkCssNode            *cssnode,
                                                          GtkStateFlags          state_flags);
-GtkStateFlags           gtk_css_node_get_state          (GtkCssNode            *cssnode);
+GtkStateFlags           gtk_css_node_get_state          (GtkCssNode            *cssnode) G_GNUC_PURE;
 void                    gtk_css_node_set_classes        (GtkCssNode            *cssnode,
                                                          const char           **classes);
 char **                 gtk_css_node_get_classes        (GtkCssNode            *cssnode);
@@ -136,13 +136,13 @@ void                    gtk_css_node_add_class          (GtkCssNode            *
 void                    gtk_css_node_remove_class       (GtkCssNode            *cssnode,
                                                          GQuark                 style_class);
 gboolean                gtk_css_node_has_class          (GtkCssNode            *cssnode,
-                                                         GQuark                 style_class);
+                                                         GQuark                 style_class) G_GNUC_PURE;
 const GQuark *          gtk_css_node_list_classes       (GtkCssNode            *cssnode,
                                                          guint                 *n_classes);
 
 const GtkCssNodeDeclaration *
-                        gtk_css_node_get_declaration    (GtkCssNode            *cssnode);
-GtkCssStyle *           gtk_css_node_get_style          (GtkCssNode            *cssnode);
+                        gtk_css_node_get_declaration    (GtkCssNode            *cssnode) G_GNUC_PURE;
+GtkCssStyle *           gtk_css_node_get_style          (GtkCssNode            *cssnode) G_GNUC_PURE;
 
 
 void                    gtk_css_node_invalidate_style_provider
@@ -157,8 +157,8 @@ void                    gtk_css_node_validate           (GtkCssNode            *
 gboolean                gtk_css_node_init_matcher       (GtkCssNode            *cssnode,
                                                          GtkCssMatcher         *matcher);
 GtkWidgetPath *         gtk_css_node_create_widget_path (GtkCssNode            *cssnode);
-const GtkWidgetPath *   gtk_css_node_get_widget_path    (GtkCssNode            *cssnode);
-GtkStyleProvider *      gtk_css_node_get_style_provider (GtkCssNode            *cssnode);
+const GtkWidgetPath *   gtk_css_node_get_widget_path    (GtkCssNode            *cssnode) G_GNUC_PURE;
+GtkStyleProvider *      gtk_css_node_get_style_provider (GtkCssNode            *cssnode) G_GNUC_PURE;
 
 void                    gtk_css_node_print              (GtkCssNode                *cssnode,
                                                          GtkStyleContextPrintFlags  flags,
diff --git a/gtk/gtkcssnumbervalueprivate.h b/gtk/gtkcssnumbervalueprivate.h
index 3ea9af6b7b..faf7dad5c9 100644
--- a/gtk/gtkcssnumbervalueprivate.h
+++ b/gtk/gtkcssnumbervalueprivate.h
@@ -61,8 +61,8 @@ gboolean        gtk_css_number_value_can_parse      (GtkCssParser           *par
 GtkCssValue *   _gtk_css_number_value_parse         (GtkCssParser           *parser,
                                                      GtkCssNumberParseFlags  flags);
 
-GtkCssDimension gtk_css_number_value_get_dimension  (const GtkCssValue      *value);
-gboolean        gtk_css_number_value_has_percent    (const GtkCssValue      *value);
+GtkCssDimension gtk_css_number_value_get_dimension  (const GtkCssValue      *value) G_GNUC_PURE;
+gboolean        gtk_css_number_value_has_percent    (const GtkCssValue      *value) G_GNUC_PURE;
 GtkCssValue *   gtk_css_number_value_multiply       (const GtkCssValue      *value,
                                                      double                  factor);
 GtkCssValue *   gtk_css_number_value_add            (GtkCssValue            *value1,
@@ -72,7 +72,7 @@ GtkCssValue *   gtk_css_number_value_try_add        (const GtkCssValue      *val
 gint            gtk_css_number_value_get_calc_term_order (const GtkCssValue *value);
 
 double          _gtk_css_number_value_get           (const GtkCssValue      *number,
-                                                     double                  one_hundred_percent);
+                                                     double                  one_hundred_percent) 
G_GNUC_PURE;
 
 
 G_END_DECLS
diff --git a/gtk/gtkcssrgbavalueprivate.h b/gtk/gtkcssrgbavalueprivate.h
index 4a2909dde4..60a0cffd6f 100644
--- a/gtk/gtkcssrgbavalueprivate.h
+++ b/gtk/gtkcssrgbavalueprivate.h
@@ -28,7 +28,7 @@ G_BEGIN_DECLS
 
 GtkCssValue *   _gtk_css_rgba_value_new_from_rgba (const GdkRGBA          *rgba);
 
-const GdkRGBA * _gtk_css_rgba_value_get_rgba      (const GtkCssValue      *rgba);
+const GdkRGBA * _gtk_css_rgba_value_get_rgba      (const GtkCssValue      *rgba) G_GNUC_PURE;
 
 
 G_END_DECLS
diff --git a/gtk/gtkcssstyleprivate.h b/gtk/gtkcssstyleprivate.h
index 536b4b8a23..a17dc4203f 100644
--- a/gtk/gtkcssstyleprivate.h
+++ b/gtk/gtkcssstyleprivate.h
@@ -61,13 +61,13 @@ struct _GtkCssStyleClass
 GType                   gtk_css_style_get_type                  (void) G_GNUC_CONST;
 
 GtkCssValue *           gtk_css_style_get_value                 (GtkCssStyle            *style,
-                                                                 guint                   id);
+                                                                 guint                   id) G_GNUC_PURE;
 GtkCssSection *         gtk_css_style_get_section               (GtkCssStyle            *style,
-                                                                 guint                   id);
+                                                                 guint                   id) G_GNUC_PURE;
 GtkBitmask *            gtk_css_style_add_difference            (GtkBitmask             *accumulated,
                                                                  GtkCssStyle            *style,
                                                                  GtkCssStyle            *other);
-gboolean                gtk_css_style_is_static                 (GtkCssStyle            *style);
+gboolean                gtk_css_style_is_static                 (GtkCssStyle            *style) G_GNUC_PURE;
 
 char *                  gtk_css_style_to_string                 (GtkCssStyle            *style);
 gboolean                gtk_css_style_print                     (GtkCssStyle            *style,


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