[gtk/matthiasc/css-change-tracking-4: 9/12] Remove no longer needed code
- From: Matthias Clasen <matthiasc src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gtk/matthiasc/css-change-tracking-4: 9/12] Remove no longer needed code
- Date: Fri, 17 Jan 2020 16:45:02 +0000 (UTC)
commit 623efeaa593f8f366eeb48a70e8f3cb50451f08e
Author: Matthias Clasen <mclasen redhat com>
Date: Fri Jan 17 11:12:13 2020 -0500
Remove no longer needed code
We no longer use superset or any matchers to find changes.
gtk/gtkcssmatcher.c | 170 ---------------------------------------------
gtk/gtkcssmatcherprivate.h | 19 +----
gtk/gtkcssselector.c | 10 ---
3 files changed, 1 insertion(+), 198 deletions(-)
---
diff --git a/gtk/gtkcssmatcher.c b/gtk/gtkcssmatcher.c
index 86e5540a47..ea082b1408 100644
--- a/gtk/gtkcssmatcher.c
+++ b/gtk/gtkcssmatcher.c
@@ -398,173 +398,3 @@ _gtk_css_matcher_node_init (GtkCssMatcher *matcher,
matcher->node.classes = gtk_css_node_declaration_get_classes (gtk_css_node_get_declaration (node),
&matcher->node.n_classes);
}
-
-/* GTK_CSS_MATCHER_ANY */
-
-static gboolean
-gtk_css_matcher_any_get_parent (GtkCssMatcher *matcher,
- const GtkCssMatcher *child)
-{
- _gtk_css_matcher_any_init (matcher);
-
- return TRUE;
-}
-
-static gboolean
-gtk_css_matcher_any_get_previous (GtkCssMatcher *matcher,
- const GtkCssMatcher *next)
-{
- _gtk_css_matcher_any_init (matcher);
-
- return TRUE;
-}
-
-static gboolean
-gtk_css_matcher_any_has_state (const GtkCssMatcher *matcher,
- GtkStateFlags state)
-{
- return TRUE;
-}
-
-static gboolean
-gtk_css_matcher_any_has_name (const GtkCssMatcher *matcher,
- /*interned*/ const char *name)
-{
- return TRUE;
-}
-
-static gboolean
-gtk_css_matcher_any_has_class (const GtkCssMatcher *matcher,
- GQuark class_name)
-{
- return TRUE;
-}
-
-static gboolean
-gtk_css_matcher_any_has_id (const GtkCssMatcher *matcher,
- const char *id)
-{
- return TRUE;
-}
-
-static gboolean
-gtk_css_matcher_any_has_position (const GtkCssMatcher *matcher,
- gboolean forward,
- int a,
- int b)
-{
- return TRUE;
-}
-
-static void
-gtk_css_matcher_any_print (const GtkCssMatcher *matcher,
- GString *string)
-{
- g_string_append (string, "ANY");
-}
-
-static const GtkCssMatcherClass GTK_CSS_MATCHER_ANY = {
- GTK_CSS_MATCHER_TYPE_ANY,
- gtk_css_matcher_any_get_parent,
- gtk_css_matcher_any_get_previous,
- gtk_css_matcher_any_has_state,
- gtk_css_matcher_any_has_name,
- gtk_css_matcher_any_has_class,
- gtk_css_matcher_any_has_id,
- gtk_css_matcher_any_has_position,
- gtk_css_matcher_any_print
-};
-
-void
-_gtk_css_matcher_any_init (GtkCssMatcher *matcher)
-{
- matcher->klass = >K_CSS_MATCHER_ANY;
-}
-
-/* GTK_CSS_MATCHER_SUPERSET */
-
-static gboolean
-gtk_css_matcher_superset_get_parent (GtkCssMatcher *matcher,
- const GtkCssMatcher *child)
-{
- _gtk_css_matcher_any_init (matcher);
-
- return TRUE;
-}
-
-static gboolean
-gtk_css_matcher_superset_get_previous (GtkCssMatcher *matcher,
- const GtkCssMatcher *next)
-{
- _gtk_css_matcher_any_init (matcher);
-
- return TRUE;
-}
-
-static gboolean
-gtk_css_matcher_superset_has_state (const GtkCssMatcher *matcher,
- GtkStateFlags state)
-{
- return TRUE;
-}
-
-static gboolean
-gtk_css_matcher_superset_has_name (const GtkCssMatcher *matcher,
- /*interned*/ const char *name)
-{
- return _gtk_css_matcher_has_name (matcher->superset.subset, name);
-}
-
-static gboolean
-gtk_css_matcher_superset_has_class (const GtkCssMatcher *matcher,
- GQuark class_name)
-{
- return _gtk_css_matcher_has_class (matcher->superset.subset, class_name);
-}
-
-static gboolean
-gtk_css_matcher_superset_has_id (const GtkCssMatcher *matcher,
- const char *id)
-{
- return _gtk_css_matcher_has_id (matcher->superset.subset, id);
-}
-
-static gboolean
-gtk_css_matcher_superset_has_position (const GtkCssMatcher *matcher,
- gboolean forward,
- int a,
- int b)
-{
- return TRUE;
-}
-
-static void
-gtk_css_matcher_superset_print (const GtkCssMatcher *matcher,
- GString *string)
-{
- g_string_append (string, "SUPERSET(");
- gtk_css_matcher_print (matcher->superset.subset, string);
- g_string_append (string, ")");
-}
-
-static const GtkCssMatcherClass GTK_CSS_MATCHER_SUPERSET = {
- GTK_CSS_MATCHER_TYPE_SUPERSET,
- gtk_css_matcher_superset_get_parent,
- gtk_css_matcher_superset_get_previous,
- gtk_css_matcher_superset_has_state,
- gtk_css_matcher_superset_has_name,
- gtk_css_matcher_superset_has_class,
- gtk_css_matcher_superset_has_id,
- gtk_css_matcher_superset_has_position,
- gtk_css_matcher_superset_print
-};
-
-void
-_gtk_css_matcher_superset_init (GtkCssMatcher *matcher,
- const GtkCssMatcher *subset)
-{
- g_return_if_fail (subset != NULL);
-
- matcher->superset.klass = >K_CSS_MATCHER_SUPERSET;
- matcher->superset.subset = subset;
-}
diff --git a/gtk/gtkcssmatcherprivate.h b/gtk/gtkcssmatcherprivate.h
index 094957bdaa..69b4f0e2e4 100644
--- a/gtk/gtkcssmatcherprivate.h
+++ b/gtk/gtkcssmatcherprivate.h
@@ -31,9 +31,7 @@ typedef struct _GtkCssMatcherClass GtkCssMatcherClass;
typedef enum {
GTK_CSS_MATCHER_TYPE_NODE,
- GTK_CSS_MATCHER_TYPE_WIDGET_PATH,
- GTK_CSS_MATCHER_TYPE_ANY,
- GTK_CSS_MATCHER_TYPE_SUPERSET
+ GTK_CSS_MATCHER_TYPE_WIDGET_PATH
} GtkCssMatcherType;
struct _GtkCssMatcherClass {
@@ -77,16 +75,10 @@ struct _GtkCssMatcherNode {
guint n_classes;
};
-struct _GtkCssMatcherSuperset {
- const GtkCssMatcherClass *klass;
- const GtkCssMatcher *subset;
-};
-
union _GtkCssMatcher {
const GtkCssMatcherClass *klass;
GtkCssMatcherWidgetPath path;
GtkCssMatcherNode node;
- GtkCssMatcherSuperset superset;
};
gboolean _gtk_css_matcher_init (GtkCssMatcher *matcher,
@@ -94,9 +86,6 @@ gboolean _gtk_css_matcher_init (GtkCssMatcher *match
const GtkCssNodeDeclaration *decl)
G_GNUC_WARN_UNUSED_RESULT;
void _gtk_css_matcher_node_init (GtkCssMatcher *matcher,
GtkCssNode *node);
-void _gtk_css_matcher_any_init (GtkCssMatcher *matcher);
-void _gtk_css_matcher_superset_init (GtkCssMatcher *matcher,
- const GtkCssMatcher *subset);
void gtk_css_matcher_print (const GtkCssMatcher *matcher,
GString *string);
@@ -154,12 +143,6 @@ _gtk_css_matcher_has_position (const GtkCssMatcher *matcher,
return matcher->klass->has_position (matcher, forward, a, b);
}
-static inline gboolean
-_gtk_css_matcher_matches_any (const GtkCssMatcher *matcher)
-{
- return matcher->klass->type == GTK_CSS_MATCHER_TYPE_ANY;
-}
-
G_END_DECLS
#endif /* __GTK_CSS_MATCHER_PRIVATE_H__ */
diff --git a/gtk/gtkcssselector.c b/gtk/gtkcssselector.c
index 6909d86f6d..bfc0dfe58b 100644
--- a/gtk/gtkcssselector.c
+++ b/gtk/gtkcssselector.c
@@ -295,11 +295,6 @@ gtk_css_selector_descendant_foreach_matcher (const GtkCssSelector *selector
if (func (selector, &ancestor, data))
return TRUE;
-
- /* any matchers are dangerous here, as we may loop forever, but
- we can terminate now as all possible matches have already been added */
- if (_gtk_css_matcher_matches_any (matcher))
- break;
}
return FALSE;
@@ -389,11 +384,6 @@ gtk_css_selector_sibling_foreach_matcher (const GtkCssSelector *selector,
if (func (selector, matcher, data))
return TRUE;
-
- /* any matchers are dangerous here, as we may loop forever, but
- we can terminate now as all possible matches have already been added */
- if (_gtk_css_matcher_matches_any (matcher))
- break;
}
return FALSE;
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]