[gnome-builder] libide: make diagnostic ctors more obvious



commit f1602c1babe8183e49c7372e1c82d877968c33e7
Author: Christian Hergert <christian hergert me>
Date:   Thu Feb 12 16:09:00 2015 -0800

    libide: make diagnostic ctors more obvious

 libide/ide-diagnostic.c |   24 ++++++++++++++----------
 libide/ide-internal.h   |   11 ++++++-----
 2 files changed, 20 insertions(+), 15 deletions(-)
---
diff --git a/libide/ide-diagnostic.c b/libide/ide-diagnostic.c
index 287b11b..d401392 100644
--- a/libide/ide-diagnostic.c
+++ b/libide/ide-diagnostic.c
@@ -87,15 +87,11 @@ _ide_diagnostic_new (IdeDiagnosticSeverity  severity,
 }
 
 void
-_ide_diagnostic_add_range (IdeDiagnostic     *self,
-                           IdeSourceLocation *begin,
-                           IdeSourceLocation *end)
+_ide_diagnostic_take_range (IdeDiagnostic  *self,
+                            IdeSourceRange *range)
 {
-  IdeSourceRange *range;
-
   g_return_if_fail (self);
-  g_return_if_fail (begin);
-  g_return_if_fail (end);
+  g_return_if_fail (range);
 
   if (!self->ranges)
     {
@@ -104,9 +100,17 @@ _ide_diagnostic_add_range (IdeDiagnostic     *self,
                                  (GDestroyNotify)ide_source_range_unref);
     }
 
-  range = _ide_source_range_new (begin, end);
-  if (range)
-    g_ptr_array_add (self->ranges, range);
+  g_ptr_array_add (self->ranges, range);
+}
+
+void
+_ide_diagnostic_add_range (IdeDiagnostic  *self,
+                           IdeSourceRange *range)
+{
+  g_return_if_fail (self);
+  g_return_if_fail (range);
+
+  _ide_diagnostic_take_range (self, ide_source_range_ref (range));
 }
 
 GType
diff --git a/libide/ide-internal.h b/libide/ide-internal.h
index 5620bf0..715a7e6 100644
--- a/libide/ide-internal.h
+++ b/libide/ide-internal.h
@@ -45,11 +45,12 @@ void _ide_diagnostician_remove_provider (IdeDiagnostician      *self,
 
 IdeDiagnostics *_ide_diagnostics_new (GPtrArray *ar);
 
-IdeDiagnostic *_ide_diagnostic_new       (IdeDiagnosticSeverity  severity,
-                                          const gchar           *text);
-void           _ide_diagnostic_add_range (IdeDiagnostic         *self,
-                                          IdeSourceLocation     *begin,
-                                          IdeSourceLocation     *end);
+IdeDiagnostic *_ide_diagnostic_new        (IdeDiagnosticSeverity  severity,
+                                           const gchar           *text);
+void           _ide_diagnostic_take_range (IdeDiagnostic         *self,
+                                           IdeSourceRange        *range);
+void           _ide_diagnostic_add_range  (IdeDiagnostic         *self,
+                                           IdeSourceRange        *range);
 
 IdeSourceRange *_ide_source_range_new (IdeSourceLocation *begin,
                                        IdeSourceLocation *end);


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