[gnome-builder/wip/chergert/razzledazzle: 8/20] build: remove libsearch



commit 9a6030df4188275b6b017ab2a476fb9546e67712
Author: Christian Hergert <chergert redhat com>
Date:   Fri Jun 2 15:58:48 2017 -0700

    build: remove libsearch
    
    Now that Dazzle has our search data structures, we can drop libsearch from
    the Builder codebase.

 contrib/gstyle/gstyle-color-panel-private.h        |    4 +-
 contrib/gstyle/gstyle-color.c                      |   31 +-
 contrib/gstyle/gstyle-palette-widget.c             |   24 +-
 contrib/gstyle/meson.build                         |    2 +-
 contrib/search/fuzzy.c                             |  617 ---------------
 contrib/search/fuzzy.h                             |   62 --
 contrib/search/meson.build                         |   21 -
 contrib/search/trie.c                              |  812 --------------------
 contrib/search/trie.h                              |   52 --
 libide/meson.build                                 |    1 -
 libide/snippets/ide-source-snippets.c              |   67 +-
 meson.build                                        |    3 +-
 plugins/file-search/gb-file-search-index.c         |   45 +-
 plugins/file-search/meson.build                    |    6 +-
 .../html-completion/ide-html-completion-provider.c |   31 +-
 plugins/html-completion/meson.build                |    6 +-
 16 files changed, 103 insertions(+), 1681 deletions(-)
---
diff --git a/contrib/gstyle/gstyle-color-panel-private.h b/contrib/gstyle/gstyle-color-panel-private.h
index 8d19bca..4bf497e 100644
--- a/contrib/gstyle/gstyle-color-panel-private.h
+++ b/contrib/gstyle/gstyle-color-panel-private.h
@@ -21,7 +21,7 @@
 
 #include <glib-object.h>
 
-#include <fuzzy.h>
+#include <dazzle.h>
 
 #include "gstyle-cielab.h"
 #include "gstyle-color.h"
@@ -76,7 +76,7 @@ struct _GstyleColorPanel
   GtkWidget                           *search_strings_popover;
   GtkWidget                           *search_strings_list;
 
-  Fuzzy                               *fuzzy;
+  DzlFuzzyMutableIndex                *fuzzy;
 
   GtkToggleButton                     *components_toggle;
   GtkToggleButton                     *strings_toggle;
diff --git a/contrib/gstyle/gstyle-color.c b/contrib/gstyle/gstyle-color.c
index cdc8dd4..dff1dc6 100644
--- a/contrib/gstyle/gstyle-color.c
+++ b/contrib/gstyle/gstyle-color.c
@@ -20,11 +20,10 @@
 
 #include <math.h>
 
+#include <dazzle.h>
 #include <glib.h>
 #include <glib/gi18n.h>
 
-#include <fuzzy.h>
-
 #include "gstyle-private.h"
 #include "gstyle-colorlexer.h"
 #include "gstyle-color-convert.h"
@@ -685,25 +684,25 @@ _parse_hsla_string (const gchar      *string,
 }
 
 /* TODO: add a public func to init so we can control the initial starting time ? */
-static Fuzzy *
+static DzlFuzzyMutableIndex *
 _init_predefined_table (void)
 {
-  static Fuzzy *predefined_table;
+  static DzlFuzzyMutableIndex *predefined_table;
   NamedColor *item;
 
   if (predefined_table == NULL)
     {
-      predefined_table = fuzzy_new (TRUE);
+      predefined_table = dzl_fuzzy_mutable_index_new (TRUE);
 
-      fuzzy_begin_bulk_insert (predefined_table);
+      dzl_fuzzy_mutable_index_begin_bulk_insert (predefined_table);
       for (guint i = 0; i < G_N_ELEMENTS (predefined_colors_table); ++i)
         {
           item = &predefined_colors_table [i];
           item->index = i;
-          fuzzy_insert (predefined_table, item->name, (gpointer)item);
+          dzl_fuzzy_mutable_index_insert (predefined_table, item->name, (gpointer)item);
         }
 
-      fuzzy_end_bulk_insert (predefined_table);
+      dzl_fuzzy_mutable_index_end_bulk_insert (predefined_table);
     }
 
   return predefined_table;
@@ -716,15 +715,15 @@ _parse_predefined_color (const gchar  *color_string,
 {
   g_autoptr (GArray) results = NULL;
   NamedColor *item = NULL;
-  FuzzyMatch *match;
   gint len;
-  Fuzzy *predefined_table = _init_predefined_table ();
+  DzlFuzzyMutableIndex *predefined_table = _init_predefined_table ();
 
-  results = fuzzy_match (predefined_table, color_string, 10);
+  results = dzl_fuzzy_mutable_index_match (predefined_table, color_string, 10);
   len = results->len;
   for (gint i = 0; i < len; ++i)
     {
-      match = &g_array_index (results, FuzzyMatch, i);
+      const DzlFuzzyMutableIndexMatch *match = &g_array_index (results, DzlFuzzyMutableIndexMatch, i);
+
       if (g_strcmp0 (color_string, match->key) == 0)
         {
           item = match->value;
@@ -753,20 +752,20 @@ gstyle_color_fuzzy_parse_color_string (const gchar *color_string)
 {
   g_autoptr (GArray) fuzzy_results = NULL;
   GPtrArray *results;
-  FuzzyMatch *match;
   NamedColor *item;
   GstyleColor *color;
   GdkRGBA rgba;
   gint len;
 
-  Fuzzy *predefined_table = _init_predefined_table ();
+  DzlFuzzyMutableIndex *predefined_table = _init_predefined_table ();
 
   results = g_ptr_array_new_with_free_func (g_object_unref);
-  fuzzy_results = fuzzy_match (predefined_table, color_string, GSTYLE_COLOR_FUZZY_SEARCH_MAX_LEN);
+  fuzzy_results = dzl_fuzzy_mutable_index_match (predefined_table, color_string, 
GSTYLE_COLOR_FUZZY_SEARCH_MAX_LEN);
   len = MIN (GSTYLE_COLOR_FUZZY_SEARCH_MAX_LEN, fuzzy_results->len);
   for (gint i = 0; i < len; ++i)
     {
-      match = &g_array_index (fuzzy_results, FuzzyMatch, i);
+      const DzlFuzzyMutableIndexMatch *match = &g_array_index (fuzzy_results, DzlFuzzyMutableIndexMatch, i);
+
       item = match->value;
       rgba.red = item->red / 255.0;
       rgba.green = item->green / 255.0;
diff --git a/contrib/gstyle/gstyle-palette-widget.c b/contrib/gstyle/gstyle-palette-widget.c
index 1927b9d..651d381 100644
--- a/contrib/gstyle/gstyle-palette-widget.c
+++ b/contrib/gstyle/gstyle-palette-widget.c
@@ -19,7 +19,7 @@
 #define G_LOG_DOMAIN "gstyle-palette-widget"
 
 #include <cairo/cairo.h>
-#include <fuzzy.h>
+#include <dazzle.h>
 #include <glib/gi18n.h>
 #include <gdk/gdk.h>
 #include <math.h>
@@ -483,20 +483,20 @@ gstyle_palette_widget_on_drag_data_received (GtkWidget        *widget,
 
 static GPtrArray *
 fuzzy_search_lookup (GstylePaletteWidget *self,
-                     Fuzzy               *fuzzy,
+                     DzlFuzzyMutableIndex               *fuzzy,
                      const gchar         *key)
 {
   g_autoptr (GArray) results = NULL;
   GPtrArray *ar = NULL;
-  FuzzyMatch *match;
+  DzlFuzzyMutableIndexMatch *match;
 
   g_assert (GSTYLE_IS_PALETTE_WIDGET (self));
   g_assert (fuzzy != NULL);
 
-  results = fuzzy_match (fuzzy, key, 1);
+  results = dzl_fuzzy_mutable_index_match (fuzzy, key, 1);
   if (results!= NULL && results->len > 0)
     {
-      match = &g_array_index (results, FuzzyMatch, 0);
+      match = &g_array_index (results, DzlFuzzyMutableIndexMatch, 0);
       if (g_strcmp0 (match->key, key))
         ar = match->value;
     }
@@ -515,10 +515,10 @@ gstyle_palette_widget_fuzzy_parse_color_string (GstylePaletteWidget *self,
                                                 const gchar         *color_string)
 {
   g_autoptr (GArray) fuzzy_results = NULL;
-  Fuzzy *fuzzy;
+  DzlFuzzyMutableIndex *fuzzy;
   GPtrArray *results;
   GPtrArray *ar, *ar_list;
-  FuzzyMatch *match;
+  DzlFuzzyMutableIndexMatch *match;
   GstylePalette *palette;
   GstyleColor *color, *new_color;
   const gchar *name;
@@ -528,7 +528,7 @@ gstyle_palette_widget_fuzzy_parse_color_string (GstylePaletteWidget *self,
 
   g_return_val_if_fail (GSTYLE_IS_PALETTE_WIDGET (self), NULL);
 
-  fuzzy = fuzzy_new (TRUE);
+  fuzzy = dzl_fuzzy_mutable_index_new (TRUE);
   ar_list = g_ptr_array_new_with_free_func ((GDestroyNotify)g_ptr_array_unref);
   nb_palettes = gstyle_palette_widget_get_n_palettes (self);
   if (nb_palettes == 0)
@@ -547,7 +547,7 @@ gstyle_palette_widget_fuzzy_parse_color_string (GstylePaletteWidget *self,
             {
               ar = g_ptr_array_new ();
               g_ptr_array_add (ar_list, ar);
-              fuzzy_insert (fuzzy, name, ar);
+              dzl_fuzzy_mutable_index_insert (fuzzy, name, ar);
               g_ptr_array_add (ar, color);
             }
           else if (!gstyle_utils_is_array_contains_same_color (ar, color))
@@ -556,11 +556,11 @@ gstyle_palette_widget_fuzzy_parse_color_string (GstylePaletteWidget *self,
     }
 
   results = g_ptr_array_new_with_free_func (g_object_unref);
-  fuzzy_results = fuzzy_match (fuzzy, color_string, GSTYLE_COLOR_FUZZY_SEARCH_MAX_LEN);
+  fuzzy_results = dzl_fuzzy_mutable_index_match (fuzzy, color_string, GSTYLE_COLOR_FUZZY_SEARCH_MAX_LEN);
   len = MIN (GSTYLE_COLOR_FUZZY_SEARCH_MAX_LEN, fuzzy_results->len);
   for (gint n = 0; n < len; ++n)
     {
-      match = &g_array_index (fuzzy_results, FuzzyMatch, n);
+      match = &g_array_index (fuzzy_results, DzlFuzzyMutableIndexMatch, n);
       ar = match->value;
       for (gint i = 0; i < ar->len; ++i)
         {
@@ -570,7 +570,7 @@ gstyle_palette_widget_fuzzy_parse_color_string (GstylePaletteWidget *self,
         }
     }
 
-  fuzzy_unref (fuzzy);
+  dzl_fuzzy_mutable_index_unref (fuzzy);
   g_ptr_array_free (ar_list, TRUE);
   return results;
 }
diff --git a/contrib/gstyle/meson.build b/contrib/gstyle/meson.build
index 601e840..9638d95 100644
--- a/contrib/gstyle/meson.build
+++ b/contrib/gstyle/meson.build
@@ -71,7 +71,7 @@ libgstyle_sources = [
 
 libgstyle_deps = [
   libgtk_dep,
-  libsearch_dep,
+  libdazzle_dep,
   libxml_dep,
   libm_dep,
 ]
diff --git a/libide/meson.build b/libide/meson.build
index a00f897..1bb6cd3 100644
--- a/libide/meson.build
+++ b/libide/meson.build
@@ -612,7 +612,6 @@ libide_deps = [
   libdazzle_dep,
   libtmpl_dep,
   libxml_dep,
-  libsearch_dep,
   libgd_dep,
   libnautilus_dep,
   libjson_glib_dep,
diff --git a/libide/snippets/ide-source-snippets.c b/libide/snippets/ide-source-snippets.c
index a8235b4..02351c4 100644
--- a/libide/snippets/ide-source-snippets.c
+++ b/libide/snippets/ide-source-snippets.c
@@ -16,6 +16,7 @@
  * along with this program.  If not, see <http://www.gnu.org/licenses/>.
  */
 
+#include <dazzle.h>
 #include <glib/gi18n.h>
 #include <string.h>
 
@@ -24,13 +25,11 @@
 #include "ide-source-snippet-parser.h"
 #include "ide-source-snippets.h"
 
-#include "trie.h"
-
 struct _IdeSourceSnippets
 {
   GObject  parent_instance;
 
-  Trie    *snippets;
+  DzlTrie *snippets;
 };
 
 
@@ -49,23 +48,23 @@ ide_source_snippets_clear (IdeSourceSnippets *snippets)
 {
   g_return_if_fail (IDE_IS_SOURCE_SNIPPETS (snippets));
 
-  trie_destroy (snippets->snippets);
-  snippets->snippets = trie_new (g_object_unref);
+  dzl_trie_destroy (snippets->snippets);
+  snippets->snippets = dzl_trie_new (g_object_unref);
 }
 
 static gboolean
-copy_into (Trie        *trie,
+copy_into (DzlTrie     *trie,
            const gchar *key,
            gpointer     value,
            gpointer     user_data)
 {
   IdeSourceSnippet *snippet = value;
-  Trie *dest = user_data;
+  DzlTrie *dest = user_data;
 
   g_assert (dest);
   g_assert (IDE_IS_SOURCE_SNIPPET (snippet));
 
-  trie_insert (dest, key, g_object_ref (snippet));
+  dzl_trie_insert (dest, key, g_object_ref (snippet));
 
   return FALSE;
 }
@@ -77,13 +76,13 @@ ide_source_snippets_merge (IdeSourceSnippets *snippets,
   g_return_if_fail (IDE_IS_SOURCE_SNIPPETS (snippets));
   g_return_if_fail (IDE_IS_SOURCE_SNIPPETS (other));
 
-  trie_traverse (other->snippets,
-                 "",
-                 G_PRE_ORDER,
-                 G_TRAVERSE_LEAVES,
-                 -1,
-                 copy_into,
-                 snippets->snippets);
+  dzl_trie_traverse (other->snippets,
+                     "",
+                     G_PRE_ORDER,
+                     G_TRAVERSE_LEAVES,
+                     -1,
+                     copy_into,
+                     snippets->snippets);
 }
 
 void
@@ -96,11 +95,11 @@ ide_source_snippets_add (IdeSourceSnippets *snippets,
   g_return_if_fail (IDE_IS_SOURCE_SNIPPET (snippet));
 
   trigger = ide_source_snippet_get_trigger (snippet);
-  trie_insert (snippets->snippets, trigger, g_object_ref (snippet));
+  dzl_trie_insert (snippets->snippets, trigger, g_object_ref (snippet));
 }
 
 static gboolean
-ide_source_snippets_foreach_cb (Trie        *trie,
+ide_source_snippets_foreach_cb (DzlTrie     *trie,
                                 const gchar *key,
                                 gpointer     value,
                                 gpointer     user_data)
@@ -131,13 +130,13 @@ ide_source_snippets_foreach (IdeSourceSnippets *snippets,
   if (!prefix)
     prefix = "";
 
-  trie_traverse (snippets->snippets,
-                 prefix,
-                 G_PRE_ORDER,
-                 G_TRAVERSE_LEAVES,
-                 -1,
-                 ide_source_snippets_foreach_cb,
-                 (gpointer) closure);
+  dzl_trie_traverse (snippets->snippets,
+                     prefix,
+                     G_PRE_ORDER,
+                     G_TRAVERSE_LEAVES,
+                     -1,
+                     ide_source_snippets_foreach_cb,
+                     (gpointer) closure);
 }
 
 static void
@@ -145,7 +144,7 @@ ide_source_snippets_finalize (GObject *object)
 {
   IdeSourceSnippets *self = IDE_SOURCE_SNIPPETS (object);
 
-  g_clear_pointer (&self->snippets, (GDestroyNotify) trie_destroy);
+  g_clear_pointer (&self->snippets, (GDestroyNotify) dzl_trie_unref);
 
   G_OBJECT_CLASS (ide_source_snippets_parent_class)->finalize (object);
 }
@@ -162,11 +161,11 @@ ide_source_snippets_class_init (IdeSourceSnippetsClass *klass)
 static void
 ide_source_snippets_init (IdeSourceSnippets *snippets)
 {
-  snippets->snippets = trie_new (g_object_unref);
+  snippets->snippets = dzl_trie_new (g_object_unref);
 }
 
 static gboolean
-increment_count (Trie        *trie,
+increment_count (DzlTrie     *trie,
                  const gchar *key,
                  gpointer     value,
                  gpointer     user_data)
@@ -183,13 +182,13 @@ ide_source_snippets_count (IdeSourceSnippets *self)
 
   g_return_val_if_fail (IDE_IS_SOURCE_SNIPPETS (self), 0);
 
-  trie_traverse (self->snippets,
-                 "",
-                 G_PRE_ORDER,
-                 G_TRAVERSE_LEAVES,
-                 -1,
-                 increment_count,
-                 &count);
+  dzl_trie_traverse (self->snippets,
+                     "",
+                     G_PRE_ORDER,
+                     G_TRAVERSE_LEAVES,
+                     -1,
+                     increment_count,
+                     &count);
 
   return count;
 }
diff --git a/meson.build b/meson.build
index b77f926..8682d99 100644
--- a/meson.build
+++ b/meson.build
@@ -178,10 +178,9 @@ subdir('contrib/gd')
 subdir('contrib/jsonrpc-glib')
 subdir('contrib/libeditorconfig')
 subdir('contrib/nautilus')
-subdir('contrib/search')
 subdir('contrib/tmpl')
 subdir('contrib/xml')
-subdir('contrib/gstyle') # Depends on libsearch/libxml
+subdir('contrib/gstyle') # Depends on libxml
 subdir('libide')
 subdir('plugins')
 subdir('po')
diff --git a/plugins/file-search/gb-file-search-index.c b/plugins/file-search/gb-file-search-index.c
index 822da34..44d5384 100644
--- a/plugins/file-search/gb-file-search-index.c
+++ b/plugins/file-search/gb-file-search-index.c
@@ -18,7 +18,6 @@
 
 #define G_LOG_DOMAIN "gb-file-search-index"
 
-#include <fuzzy.h>
 #include <glib/gi18n.h>
 #include <ide.h>
 
@@ -27,10 +26,10 @@
 
 struct _GbFileSearchIndex
 {
-  IdeObject     parent_instance;
+  IdeObject             parent_instance;
 
-  GFile        *root_directory;
-  Fuzzy        *fuzzy;
+  GFile                *root_directory;
+  DzlFuzzyMutableIndex *fuzzy;
 };
 
 G_DEFINE_TYPE (GbFileSearchIndex, gb_file_search_index, IDE_TYPE_OBJECT)
@@ -52,7 +51,7 @@ gb_file_search_index_set_root_directory (GbFileSearchIndex *self,
 
   if (g_set_object (&self->root_directory, root_directory))
     {
-      g_clear_pointer (&self->fuzzy, fuzzy_unref);
+      g_clear_pointer (&self->fuzzy, dzl_fuzzy_mutable_index_unref);
 
       g_object_notify_by_pspec (G_OBJECT (self), properties [PROP_ROOT_DIRECTORY]);
     }
@@ -64,7 +63,7 @@ gb_file_search_index_finalize (GObject *object)
   GbFileSearchIndex *self = (GbFileSearchIndex *)object;
 
   g_clear_object (&self->root_directory);
-  g_clear_pointer (&self->fuzzy, fuzzy_unref);
+  g_clear_pointer (&self->fuzzy, dzl_fuzzy_mutable_index_unref);
 
   G_OBJECT_CLASS (gb_file_search_index_parent_class)->finalize (object);
 }
@@ -132,11 +131,11 @@ gb_file_search_index_init (GbFileSearchIndex *self)
 }
 
 static void
-populate_from_dir (Fuzzy        *fuzzy,
-                   IdeVcs       *vcs,
-                   const gchar  *relpath,
-                   GFile        *directory,
-                   GCancellable *cancellable)
+populate_from_dir (DzlFuzzyMutableIndex *fuzzy,
+                   IdeVcs               *vcs,
+                   const gchar          *relpath,
+                   GFile                *directory,
+                   GCancellable         *cancellable)
 {
   GFileEnumerator *enumerator;
   GPtrArray *children = NULL;
@@ -183,7 +182,7 @@ populate_from_dir (Fuzzy        *fuzzy,
       if (relpath != NULL)
         name = path = g_build_filename (relpath, name, NULL);
 
-      fuzzy_insert (fuzzy, name, NULL);
+      dzl_fuzzy_mutable_index_insert (fuzzy, name, NULL);
     }
 
   g_clear_object (&enumerator);
@@ -222,7 +221,7 @@ gb_file_search_index_builder (GTask        *task,
   GFile *directory = task_data;
   IdeContext *context;
   IdeVcs *vcs;
-  Fuzzy *fuzzy;
+  DzlFuzzyMutableIndex *fuzzy;
   gdouble elapsed;
 
   g_assert (G_IS_TASK (task));
@@ -235,10 +234,10 @@ gb_file_search_index_builder (GTask        *task,
 
   timer = g_timer_new ();
 
-  fuzzy = fuzzy_new (FALSE);
-  fuzzy_begin_bulk_insert (fuzzy);
+  fuzzy = dzl_fuzzy_mutable_index_new (FALSE);
+  dzl_fuzzy_mutable_index_begin_bulk_insert (fuzzy);
   populate_from_dir (fuzzy, vcs, NULL, directory, cancellable);
-  fuzzy_end_bulk_insert (fuzzy);
+  dzl_fuzzy_mutable_index_end_bulk_insert (fuzzy);
 
   self->fuzzy = fuzzy;
 
@@ -326,20 +325,20 @@ gb_file_search_index_populate (GbFileSearchIndex *self,
         g_string_append_unichar (delimited, ch);
     }
 
-  ar = fuzzy_match (self->fuzzy, delimited->str, max_matches);
+  ar = dzl_fuzzy_mutable_index_match (self->fuzzy, delimited->str, max_matches);
 
   for (i = 0; i < ar->len; i++)
     {
-      FuzzyMatch *match;
+      const DzlFuzzyMutableIndexMatch *match;
 
-      match = &g_array_index (ar, FuzzyMatch, i);
+      match = &g_array_index (ar, DzlFuzzyMutableIndexMatch, i);
 
       if (ide_search_reducer_accepts (&reducer, match->score))
         {
           g_autoptr(GbFileSearchResult) result = NULL;
           g_autofree gchar *markup = NULL;
 
-          markup = ide_completion_item_fuzzy_highlight (match->key, delimited->str);
+          markup = dzl_fuzzy_highlight (match->key, delimited->str, FALSE);
           result = g_object_new (GB_TYPE_FILE_SEARCH_RESULT,
                                  "context", icontext,
                                  "provider", provider,
@@ -360,7 +359,7 @@ gb_file_search_index_contains (GbFileSearchIndex *self,
   g_return_val_if_fail (relative_path != NULL, FALSE);
   g_return_val_if_fail (self->fuzzy != NULL, FALSE);
 
-  return fuzzy_contains (self->fuzzy, relative_path);
+  return dzl_fuzzy_mutable_index_contains (self->fuzzy, relative_path);
 }
 
 void
@@ -371,7 +370,7 @@ gb_file_search_index_insert (GbFileSearchIndex *self,
   g_return_if_fail (relative_path != NULL);
   g_return_if_fail (self->fuzzy != NULL);
 
-  fuzzy_insert (self->fuzzy, relative_path, NULL);
+  dzl_fuzzy_mutable_index_insert (self->fuzzy, relative_path, NULL);
 }
 
 void
@@ -382,5 +381,5 @@ gb_file_search_index_remove (GbFileSearchIndex *self,
   g_return_if_fail (relative_path != NULL);
   g_return_if_fail (self->fuzzy != NULL);
 
-  fuzzy_remove (self->fuzzy, relative_path);
+  dzl_fuzzy_mutable_index_remove (self->fuzzy, relative_path);
 }
diff --git a/plugins/file-search/meson.build b/plugins/file-search/meson.build
index f0988ee..047d91d 100644
--- a/plugins/file-search/meson.build
+++ b/plugins/file-search/meson.build
@@ -9,12 +9,8 @@ file_search_sources = [
   'gb-file-search-index.h',
 ]
 
-file_search_deps = plugin_deps + [
-  libsearch_dep,
-]
-
 shared_module('file-search', file_search_sources,
-  dependencies: file_search_deps,
+  dependencies: plugin_deps,
   link_args: plugin_link_args,
   link_depends: plugin_link_deps,
   install: true,
diff --git a/plugins/html-completion/ide-html-completion-provider.c 
b/plugins/html-completion/ide-html-completion-provider.c
index baa0bea..d2edded 100644
--- a/plugins/html-completion/ide-html-completion-provider.c
+++ b/plugins/html-completion/ide-html-completion-provider.c
@@ -18,16 +18,15 @@
 
 #define G_LOG_DOMAIN "html-completion"
 
+#include <dazzle.h>
 #include <libpeas/peas.h>
 #include <string.h>
 
 #include "ide-html-completion-provider.h"
 
-#include "trie.h"
-
 static GHashTable *element_attrs;
-static Trie *css_styles;
-static Trie *elements;
+static DzlTrie *css_styles;
+static DzlTrie *elements;
 
 enum {
   MODE_NONE,
@@ -270,7 +269,7 @@ get_mode (GtkSourceCompletionContext *context)
 }
 
 static gboolean
-traverse_cb (Trie        *trie,
+traverse_cb (DzlTrie        *trie,
              const gchar *key,
              gpointer     value,
              gpointer     user_data)
@@ -367,7 +366,7 @@ ide_html_completion_provider_populate (GtkSourceCompletionProvider *provider,
                                       GtkSourceCompletionContext  *context)
 {
   SearchState state = { 0 };
-  Trie *trie = NULL;
+  DzlTrie *trie = NULL;
   gchar *word;
   gint mode;
 
@@ -418,7 +417,7 @@ ide_html_completion_provider_populate (GtkSourceCompletionProvider *provider,
    */
   if (trie && word)
     {
-      trie_traverse (trie, word, G_PRE_ORDER, G_TRAVERSE_LEAVES, -1,
+      dzl_trie_traverse (trie, word, G_PRE_ORDER, G_TRAVERSE_LEAVES, -1,
                      traverse_cb, &state);
     }
 
@@ -427,10 +426,10 @@ ide_html_completion_provider_populate (GtkSourceCompletionProvider *provider,
    */
   if (mode == MODE_ATTRIBUTE_NAME)
     {
-      Trie *global;
+      DzlTrie *global;
 
       global = g_hash_table_lookup (element_attrs, "*");
-      trie_traverse (global, word, G_PRE_ORDER, G_TRAVERSE_LEAVES, -1,
+      dzl_trie_traverse (global, word, G_PRE_ORDER, G_TRAVERSE_LEAVES, -1,
                      traverse_cb, &state);
     }
 
@@ -462,20 +461,20 @@ ide_html_completion_provider_class_finalize (IdeHtmlCompletionProviderClass *kla
 static void
 ide_html_completion_provider_class_init (IdeHtmlCompletionProviderClass *klass)
 {
-  elements = trie_new (NULL);
+  elements = dzl_trie_new (NULL);
   element_attrs = g_hash_table_new (g_str_hash, g_str_equal);
-  css_styles = trie_new (NULL);
+  css_styles = dzl_trie_new (NULL);
 
-#define ADD_ELEMENT(str)        trie_insert(elements,str,str)
-#define ADD_STRING(dict, str)   trie_insert(dict,str,str)
+#define ADD_ELEMENT(str)        dzl_trie_insert(elements,str,str)
+#define ADD_STRING(dict, str)   dzl_trie_insert(dict,str,str)
 #define ADD_ATTRIBUTE(ele,attr) \
   G_STMT_START { \
-    Trie *t = g_hash_table_lookup (element_attrs, ele); \
+    DzlTrie *t = g_hash_table_lookup (element_attrs, ele); \
     if (!t) { \
-      t = trie_new (NULL); \
+      t = dzl_trie_new (NULL); \
       g_hash_table_insert (element_attrs, ele, t); \
     } \
-    trie_insert (t,attr,attr); \
+    dzl_trie_insert (t,attr,attr); \
   } G_STMT_END
 
   /*
diff --git a/plugins/html-completion/meson.build b/plugins/html-completion/meson.build
index 6c5b6e9..d54c7d8 100644
--- a/plugins/html-completion/meson.build
+++ b/plugins/html-completion/meson.build
@@ -5,12 +5,8 @@ html_completion_sources = [
        'ide-html-completion-provider.h',
 ]
 
-html_completion_deps = plugin_deps + [
-  libsearch_dep,
-]
-
 shared_module('html-completion-plugin', html_completion_sources,
-  dependencies: html_completion_deps,
+  dependencies: plugin_deps,
   link_args: plugin_link_args,
   link_depends: plugin_link_deps,
   install: true,


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