[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[PATCH v3 05/12] util/range: use append_new_range() in range_list_from_s
From: |
Sven Schnelle |
Subject: |
[PATCH v3 05/12] util/range: use append_new_range() in range_list_from_string() |
Date: |
Fri, 1 Mar 2024 18:46:02 +0100 |
Use append_new_ranges() instead of manually allocating and
filling the new range member.
Signed-off-by: Sven Schnelle <svens@stackframe.org>
---
util/range.c | 7 +------
1 file changed, 1 insertion(+), 6 deletions(-)
diff --git a/util/range.c b/util/range.c
index 7234ab7a53..db535de9a7 100644
--- a/util/range.c
+++ b/util/range.c
@@ -128,7 +128,6 @@ void range_list_from_string(GList **out_ranges, const char
*filter_spec,
Error **errp)
{
gchar **ranges = g_strsplit(filter_spec, ",", 0);
- struct Range *range = NULL;
int i;
if (*out_ranges) {
@@ -140,7 +139,6 @@ void range_list_from_string(GList **out_ranges, const char
*filter_spec,
const char *r = ranges[i];
const char *range_op, *r2, *e;
uint64_t r1val, r2val, lob, upb;
- range = g_new0(struct Range, 1);
range_op = strstr(r, "-");
r2 = range_op ? range_op + 1 : NULL;
@@ -189,12 +187,9 @@ void range_list_from_string(GList **out_ranges, const char
*filter_spec,
error_setg(errp, "Invalid range");
goto out;
}
- range_set_bounds(range, lob, upb);
- *out_ranges = g_list_append(*out_ranges, range);
- range = NULL;
+ *out_ranges = append_new_range(*out_ranges, lob, upb);
}
out:
- g_free(range);
g_strfreev(ranges);
}
--
2.43.2
[PATCH v3 06/12] util/range: split up range_list_from_string(), Sven Schnelle, 2024/03/01
[PATCH v3 05/12] util/range: use append_new_range() in range_list_from_string(),
Sven Schnelle <=
[PATCH v3 02/12] util/log: make qemu_set_dfilter_ranges() take a GList, Sven Schnelle, 2024/03/01
[PATCH v3 03/12] util/range: move range_list_from_string() to range.c, Sven Schnelle, 2024/03/01
[PATCH v3 07/12] util/range: make range_list_from_string() accept a single number, Sven Schnelle, 2024/03/01
[PATCH v3 08/12] qemu/range: add range_list_contains() function, Sven Schnelle, 2024/03/01
[PATCH v3 04/12] util/range: add range_list_free(), Sven Schnelle, 2024/03/01
[PATCH v3 10/12] plugins: add range list API, Sven Schnelle, 2024/03/01
[PATCH v3 12/12] plugins/execlog: add data address match, Sven Schnelle, 2024/03/01
[PATCH v3 09/12] plugins: add API to print errors, Sven Schnelle, 2024/03/01
[PATCH v3 11/12] plugins/execlog: use range list api, Sven Schnelle, 2024/03/01