mirror of
https://gitlab.gnome.org/GNOME/gtk.git
synced 2024-12-27 06:00:22 +00:00
stack-allocate GtkCssLookup instances
This commit is contained in:
parent
fcc8d778b5
commit
355b883f32
@ -24,12 +24,11 @@
|
||||
#include "gtkprivatetypebuiltins.h"
|
||||
#include "gtkprivate.h"
|
||||
|
||||
GtkCssLookup *
|
||||
_gtk_css_lookup_new (const GtkBitmask *relevant)
|
||||
void
|
||||
_gtk_css_lookup_init (GtkCssLookup *lookup,
|
||||
const GtkBitmask *relevant)
|
||||
{
|
||||
GtkCssLookup *lookup;
|
||||
|
||||
lookup = g_malloc0 (sizeof (GtkCssLookup));
|
||||
memset (lookup, 0, sizeof (*lookup));
|
||||
|
||||
if (relevant)
|
||||
{
|
||||
@ -40,17 +39,12 @@ _gtk_css_lookup_new (const GtkBitmask *relevant)
|
||||
lookup->missing = _gtk_bitmask_new ();
|
||||
lookup->missing = _gtk_bitmask_invert_range (lookup->missing, 0, GTK_CSS_PROPERTY_N_PROPERTIES);
|
||||
}
|
||||
|
||||
return lookup;
|
||||
}
|
||||
|
||||
void
|
||||
_gtk_css_lookup_free (GtkCssLookup *lookup)
|
||||
_gtk_css_lookup_destroy (GtkCssLookup *lookup)
|
||||
{
|
||||
gtk_internal_return_if_fail (lookup != NULL);
|
||||
|
||||
_gtk_bitmask_free (lookup->missing);
|
||||
g_free (lookup);
|
||||
}
|
||||
|
||||
gboolean
|
||||
|
@ -38,8 +38,9 @@ struct _GtkCssLookup {
|
||||
GtkCssLookupValue values[GTK_CSS_PROPERTY_N_PROPERTIES];
|
||||
};
|
||||
|
||||
GtkCssLookup * _gtk_css_lookup_new (const GtkBitmask *relevant);
|
||||
void _gtk_css_lookup_free (GtkCssLookup *lookup);
|
||||
void _gtk_css_lookup_init (GtkCssLookup *lookup,
|
||||
const GtkBitmask *relevant);
|
||||
void _gtk_css_lookup_destroy (GtkCssLookup *lookup);
|
||||
|
||||
static inline const GtkBitmask *_gtk_css_lookup_get_missing (const GtkCssLookup *lookup);
|
||||
gboolean _gtk_css_lookup_is_missing (const GtkCssLookup *lookup,
|
||||
|
@ -172,27 +172,27 @@ gtk_css_static_style_new_compute (GtkStyleProvider *provider,
|
||||
GtkCssStyle *parent)
|
||||
{
|
||||
GtkCssStaticStyle *result;
|
||||
GtkCssLookup *lookup;
|
||||
GtkCssLookup lookup;
|
||||
GtkCssChange change = GTK_CSS_CHANGE_ANY_SELF | GTK_CSS_CHANGE_ANY_SIBLING | GTK_CSS_CHANGE_ANY_PARENT;
|
||||
|
||||
lookup = _gtk_css_lookup_new (NULL);
|
||||
_gtk_css_lookup_init (&lookup, NULL);
|
||||
|
||||
if (matcher)
|
||||
gtk_style_provider_lookup (provider,
|
||||
matcher,
|
||||
lookup,
|
||||
&lookup,
|
||||
&change);
|
||||
|
||||
result = g_object_new (GTK_TYPE_CSS_STATIC_STYLE, NULL);
|
||||
|
||||
result->change = change;
|
||||
|
||||
_gtk_css_lookup_resolve (lookup,
|
||||
_gtk_css_lookup_resolve (&lookup,
|
||||
provider,
|
||||
result,
|
||||
parent);
|
||||
|
||||
_gtk_css_lookup_free (lookup);
|
||||
_gtk_css_lookup_destroy (&lookup);
|
||||
|
||||
return GTK_CSS_STYLE (result);
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user