[gtk] rbtree: Remove gtk_rb_tree_find()



commit 7ff949ea30edc8abd8cfd8ca30aa26632033f106
Author: Benjamin Otte <otte redhat com>
Date:   Sat Jan 12 15:09:37 2019 +0100

    rbtree: Remove gtk_rb_tree_find()
    
    Searching through the tree is too specific to use a general function.
    All the existing code just copies and slightly adapts the same 20 lines
    instead, so there's no reason to keep the complicated API.

 gtk/gtkrbtree.c        | 52 --------------------------------------------------
 gtk/gtkrbtreeprivate.h |  9 ---------
 2 files changed, 61 deletions(-)
---
diff --git a/gtk/gtkrbtree.c b/gtk/gtkrbtree.c
index a7576ffc2b..bcadb8eed1 100644
--- a/gtk/gtkrbtree.c
+++ b/gtk/gtkrbtree.c
@@ -707,55 +707,3 @@ gtk_rb_tree_remove_all (GtkRbTree *tree)
   tree->root = NULL;
 }
 
-gpointer
-gtk_rb_tree_find (GtkRbTree           *tree,
-                  gpointer            *out_before,
-                  gpointer            *out_after,
-                  GtkRbTreeFindFunc    find_func,
-                  gpointer             user_data)
-{
-  GtkRbNode *node, *before = NULL, *after = NULL;
-  int cmp;
-
-  if (tree->root == NULL)
-    {
-      if (out_before)
-        *out_before = NULL;
-      if (out_after)
-        *out_after = NULL;
-
-      return NULL;
-    }
-
-  node = tree->root;
-  for (cmp = find_func (tree, NODE_TO_POINTER (node), user_data);
-       cmp != 0;
-       cmp = find_func (tree, NODE_TO_POINTER (node), user_data))
-    {
-      if (cmp < 0)
-        {
-          before = node;
-          node = node->right;
-        }
-      else /* cmp > 0 */
-        {
-          after = node;
-          node = node->left;
-        }
-      if (node == NULL)
-        {
-          if (out_before)
-            *out_before = NODE_TO_POINTER (before);
-          if (out_after)
-            *out_after = NODE_TO_POINTER (after);
-          return NULL;;
-        }
-    }
-
-  if (out_before)
-    *out_before = NODE_TO_POINTER (gtk_rb_node_get_previous (node));
-  if (out_after)
-    *out_after = NODE_TO_POINTER (gtk_rb_node_get_next (node));
-
-  return NODE_TO_POINTER (node);
-}
diff --git a/gtk/gtkrbtreeprivate.h b/gtk/gtkrbtreeprivate.h
index b73c80708d..46b6b0db86 100644
--- a/gtk/gtkrbtreeprivate.h
+++ b/gtk/gtkrbtreeprivate.h
@@ -33,9 +33,6 @@ typedef void            (* GtkRbTreeAugmentFunc)        (GtkRbTree
                                                          gpointer                 node,
                                                          gpointer                 left,
                                                          gpointer                 right);
-typedef int             (* GtkRbTreeFindFunc)           (GtkRbTree               *tree,
-                                                         gpointer                 node,
-                                                         gpointer                 user_data);
 
 GtkRbTree *          gtk_rb_tree_new_for_size           (gsize                    element_size,
                                                          gsize                    augment_size,
@@ -76,12 +73,6 @@ void                 gtk_rb_tree_remove                 (GtkRbTree
                                                          gpointer                 node);
 void                 gtk_rb_tree_remove_all             (GtkRbTree               *tree);
 
-gpointer             gtk_rb_tree_find                   (GtkRbTree               *tree,
-                                                         gpointer                *out_before,
-                                                         gpointer                *out_after,
-                                                         GtkRbTreeFindFunc        find_func,
-                                                         gpointer                 user_data);
-
 
 G_END_DECLS
 


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