[gnome-builder] highlight: use boxed type, increment ref count
- From: Christian Hergert <chergert src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gnome-builder] highlight: use boxed type, increment ref count
- Date: Fri, 27 Mar 2015 00:38:40 +0000 (UTC)
commit b59a44f536a7ee0a15dc68fc505fe8783e7cf2a7
Author: Christian Hergert <christian hergert me>
Date: Thu Mar 26 13:11:30 2015 -0700
highlight: use boxed type, increment ref count
libide/ide-highlight-index.c | 5 +++++
libide/ide-highlight-index.h | 21 +++++++++++++--------
2 files changed, 18 insertions(+), 8 deletions(-)
---
diff --git a/libide/ide-highlight-index.c b/libide/ide-highlight-index.c
index 03e79d6..ff80531 100644
--- a/libide/ide-highlight-index.c
+++ b/libide/ide-highlight-index.c
@@ -20,6 +20,9 @@
#include "ide-highlight-index.h"
+G_DEFINE_BOXED_TYPE (IdeHighlightIndex, ide_highlight_index,
+ ide_highlight_index_ref, ide_highlight_index_unref)
+
struct _IdeHighlightIndex
{
volatile gint ref_count;
@@ -78,6 +81,8 @@ ide_highlight_index_ref (IdeHighlightIndex *self)
g_assert (self);
g_assert_cmpint (self->ref_count, >, 0);
+ g_atomic_int_inc (&self->ref_count);
+
return self;
}
diff --git a/libide/ide-highlight-index.h b/libide/ide-highlight-index.h
index 6a0887c..c36d173 100644
--- a/libide/ide-highlight-index.h
+++ b/libide/ide-highlight-index.h
@@ -23,16 +23,21 @@
G_BEGIN_DECLS
+#define IDE_TYPE_HIGHLIGHT_INDEX (ide_highlight_index_get_type())
+
typedef struct _IdeHighlightIndex IdeHighlightIndex;
-IdeHighlightIndex *ide_highlight_index_new (void);
-IdeHighlightIndex *ide_highlight_index_ref (IdeHighlightIndex *self);
-void ide_highlight_index_unref (IdeHighlightIndex *self);
-void ide_highlight_index_insert (IdeHighlightIndex *self,
- const gchar *word,
- IdeHighlightKind kind);
-IdeHighlightKind ide_highlight_index_lookup (IdeHighlightIndex *self,
- const gchar *word);
+GType ide_highlight_index_get_type (void);
+IdeHighlightIndex *ide_highlight_index_new (void);
+IdeHighlightIndex *ide_highlight_index_ref (IdeHighlightIndex *self);
+void ide_highlight_index_unref (IdeHighlightIndex *self);
+void ide_highlight_index_insert (IdeHighlightIndex *self,
+ const gchar *word,
+ IdeHighlightKind kind);
+IdeHighlightKind ide_highlight_index_lookup (IdeHighlightIndex *self,
+ const gchar *word);
+
+G_DEFINE_AUTOPTR_CLEANUP_FUNC (IdeHighlightIndex, ide_highlight_index_unref)
G_END_DECLS
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]