css: Mark some hot functions as G_GNUC_PURE

By doing that, gcc will generate code that avoids calling these
functions when not needed.
This commit is contained in:
Benjamin Otte 2019-02-15 04:06:22 +01:00
parent 285aba6ece
commit 7ad0f7fc52
4 changed files with 22 additions and 22 deletions

View File

@ -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,

View File

@ -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

View File

@ -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

View File

@ -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,