Update g array ref
authorMathieu Desnoyers <mathieu.desnoyers@efficios.com>
Tue, 22 Feb 2011 10:27:45 +0000 (05:27 -0500)
committerMathieu Desnoyers <mathieu.desnoyers@efficios.com>
Tue, 22 Feb 2011 10:27:45 +0000 (05:27 -0500)
Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
include/babeltrace/types.h
types/enum.c

index d6ac792438bf5573b6f4eb103687e43370656614..a315c4c387cbbf517963fdb0bb48cadfe1b0bf2f 100644 (file)
@@ -236,7 +236,8 @@ GArray *enum_int_to_quark_set(const struct type_class_enum *enum_class,
 
 /*
  * Returns a GArray of struct enum_range or NULL.
- * Caller must release the GArray with g_array_unref().
+ * Callers do _not_ own the returned GArray (and therefore _don't_ need to
+ * release it).
  */
 GArray *enum_quark_to_range_set(const struct type_class_enum *enum_class,
                                GQuark q);
index 38a972a9c300392c467e56840df3312dad657691..6ad4d45038eabf37da04b05944b290d3bff983fe 100644 (file)
@@ -62,8 +62,10 @@ GArray *enum_uint_to_quark_set(const struct type_class_enum *enum_class,
                        g_array_index(ranges, struct enum_range, ranges->len) = iter->range;
                }
        }
-       if (!ranges)
+       if (!ranges) {
                ranges = qs;
+               g_array_ref(ranges);
+       }
        return ranges;
 }
 
@@ -101,8 +103,10 @@ GArray *enum_int_to_quark_set(const struct type_class_enum *enum_class, uint64_t
                        g_array_index(ranges, struct enum_range, ranges->len) = iter->range;
                }
        }
-       if (!ranges)
+       if (!ranges) {
                ranges = qs;
+               g_array_ref(ranges);
+       }
        return ranges;
 }
 
This page took 0.025388 seconds and 4 git commands to generate.