[gnome-builder] diagnostics: allow NULL for array of diagnostics



commit cefc6452927efc1dc0f690fe12143e10dc6f60c4
Author: Christian Hergert <chergert redhat com>
Date:   Thu Oct 27 18:13:58 2016 -0700

    diagnostics: allow NULL for array of diagnostics
    
    This is helpful when we want an "empty set" of diagnostics to notify the
    consumer that diagnostics were resolved.

 libide/diagnostics/ide-diagnostics.c |    3 +++
 1 files changed, 3 insertions(+), 0 deletions(-)
---
diff --git a/libide/diagnostics/ide-diagnostics.c b/libide/diagnostics/ide-diagnostics.c
index a64a8e1..8d8a2b6 100644
--- a/libide/diagnostics/ide-diagnostics.c
+++ b/libide/diagnostics/ide-diagnostics.c
@@ -47,6 +47,9 @@ ide_diagnostics_new (GPtrArray *ar)
 {
   IdeDiagnostics *ret;
 
+  if (ar == NULL)
+    ar = g_ptr_array_new_with_free_func ((GDestroyNotify)ide_diagnostic_unref);
+
   ret = g_slice_new0 (IdeDiagnostics);
   ret->ref_count = 1;
   ret->diagnostics = ar;


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