[gnome-builder] ctags: allow copying an index entry for thread safety
- From: Christian Hergert <chergert src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gnome-builder] ctags: allow copying an index entry for thread safety
- Date: Thu, 16 Jul 2015 21:11:14 +0000 (UTC)
commit dff89390b0d5656d94db56de4b0cb4974e6c222b
Author: Christian Hergert <christian hergert me>
Date: Thu Jul 16 13:36:08 2015 -0700
ctags: allow copying an index entry for thread safety
Sometimes we might want access to the entry from another thread. This
allows us to quickly do so.
plugins/ctags/ide-ctags-index.c | 23 +++++++++++++++++++++++
plugins/ctags/ide-ctags-index.h | 6 ++++--
2 files changed, 27 insertions(+), 2 deletions(-)
---
diff --git a/plugins/ctags/ide-ctags-index.c b/plugins/ctags/ide-ctags-index.c
index f5e71d5..e60670e 100644
--- a/plugins/ctags/ide-ctags-index.c
+++ b/plugins/ctags/ide-ctags-index.c
@@ -564,6 +564,29 @@ ide_ctags_index_resolve_path (IdeCtagsIndex *self,
return g_build_filename (self->path_root, relative_path, NULL);
}
+IdeCtagsIndexEntry *
+ide_ctags_index_entry_copy (const IdeCtagsIndexEntry *entry)
+{
+ IdeCtagsIndexEntry *copy;
+
+ copy = g_slice_new0 (IdeCtagsIndexEntry);
+ copy->name = g_strdup (entry->name);
+ copy->path = g_strdup (entry->path);
+ copy->pattern = g_strdup (entry->pattern);
+ copy->kind = entry->kind;
+
+ return copy;
+}
+
+void
+ide_ctags_index_entry_free (IdeCtagsIndexEntry *entry)
+{
+ g_free ((gchar *)entry->name);
+ g_free ((gchar *)entry->path);
+ g_free ((gchar *)entry->pattern);
+ g_slice_free (IdeCtagsIndexEntry, entry);
+}
+
const IdeCtagsIndexEntry *
ide_ctags_index_lookup (IdeCtagsIndex *self,
const gchar *keyword,
diff --git a/plugins/ctags/ide-ctags-index.h b/plugins/ctags/ide-ctags-index.h
index 2a2c4f5..ddbcfde 100644
--- a/plugins/ctags/ide-ctags-index.h
+++ b/plugins/ctags/ide-ctags-index.h
@@ -77,8 +77,10 @@ const IdeCtagsIndexEntry *ide_ctags_index_lookup_prefix (IdeCtagsIndex *s
const gchar *keyword,
gsize *length);
-gint ide_ctags_index_entry_compare (gconstpointer a,
- gconstpointer b);
+gint ide_ctags_index_entry_compare (gconstpointer a,
+ gconstpointer b);
+IdeCtagsIndexEntry *ide_ctags_index_entry_copy (const IdeCtagsIndexEntry *entry);
+void ide_ctags_index_entry_free (IdeCtagsIndexEntry *entry);
G_END_DECLS
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]