diff mbox series

[2/4] plugins/execlog: pass matches array to parse_vaddr_match

Message ID 20240228200211.1512816-3-svens@stackframe.org (mailing list archive)
State New, archived
Headers show
Series plugins/execlog: add data address match and address range support | expand

Commit Message

Sven Schnelle Feb. 28, 2024, 8:02 p.m. UTC
Pass the matches array to parse_vaddr_match(), so future address
matches can reuse that function.

Signed-off-by: Sven Schnelle <svens@stackframe.org>
---
 contrib/plugins/execlog.c | 10 +++++-----
 1 file changed, 5 insertions(+), 5 deletions(-)
diff mbox series

Patch

diff --git a/contrib/plugins/execlog.c b/contrib/plugins/execlog.c
index 90da1911b2..b4b5ba113c 100644
--- a/contrib/plugins/execlog.c
+++ b/contrib/plugins/execlog.c
@@ -206,14 +206,14 @@  static void parse_insn_match(char *match)
     g_ptr_array_add(imatches, match);
 }
 
-static void parse_vaddr_match(char *match)
+static void parse_vaddr_match(GArray **matches, char *match)
 {
     uint64_t v = g_ascii_strtoull(match, NULL, 16);
 
-    if (!amatches) {
-        amatches = g_array_new(false, true, sizeof(uint64_t));
+    if (!matches) {
+        *matches = g_array_new(false, true, sizeof(uint64_t));
     }
-    g_array_append_val(amatches, v);
+    g_array_append_val(*matches, v);
 }
 
 /**
@@ -239,7 +239,7 @@  QEMU_PLUGIN_EXPORT int qemu_plugin_install(qemu_plugin_id_t id,
         if (g_strcmp0(tokens[0], "ifilter") == 0) {
             parse_insn_match(tokens[1]);
         } else if (g_strcmp0(tokens[0], "afilter") == 0) {
-            parse_vaddr_match(tokens[1]);
+            parse_vaddr_match(&amatches, tokens[1]);
         } else {
             fprintf(stderr, "option parsing failed: %s\n", opt);
             return -1;