diff mbox series

[v3,04/12] util/range: add range_list_free()

Message ID 20240301174609.1964379-5-svens@stackframe.org
State New
Headers show
Series plugins/execlog: add data address match and address range support | expand

Commit Message

Sven Schnelle March 1, 2024, 5:46 p.m. UTC
Introduce range_list_free(), which takes a GList of ranges
and frees the list and each range.

Signed-off-by: Sven Schnelle <svens@stackframe.org>
---
 include/qemu/range.h | 5 +++++
 util/range.c         | 5 +++++
 2 files changed, 10 insertions(+)
diff mbox series

Patch

diff --git a/include/qemu/range.h b/include/qemu/range.h
index 530b0c7db1..4ff9799d89 100644
--- a/include/qemu/range.h
+++ b/include/qemu/range.h
@@ -240,4 +240,9 @@  void range_inverse_array(GList *in_ranges,
 void range_list_from_string(GList **out_ranges, const char *filter_spec,
                             Error **errp);
 
+/*
+ * Free a list of ranges.
+ */
+void range_list_free(GList *ranges);
+
 #endif
diff --git a/util/range.c b/util/range.c
index bd2d0961bd..7234ab7a53 100644
--- a/util/range.c
+++ b/util/range.c
@@ -197,3 +197,8 @@  out:
     g_free(range);
     g_strfreev(ranges);
 }
+
+void range_list_free(GList *ranges)
+{
+    g_list_free_full(ranges, g_free);
+}