[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[PULL 24/25] trace: replace hand-crafted pattern_glob with g_pattern_mat
From: |
Alex Bennée |
Subject: |
[PULL 24/25] trace: replace hand-crafted pattern_glob with g_pattern_match_simple |
Date: |
Thu, 19 Dec 2019 10:49:33 +0000 |
We already use g_pattern_match elsewhere so remove the duplication.
Signed-off-by: Alex Bennée <address@hidden>
Reviewed-by: Richard Henderson <address@hidden>
Reviewed-by: Stefan Hajnoczi <address@hidden>
Message-Id: <address@hidden>
diff --git a/trace/control.c b/trace/control.c
index d9cafc161bb..0fb81241607 100644
--- a/trace/control.c
+++ b/trace/control.c
@@ -98,38 +98,6 @@ TraceEvent *trace_event_name(const char *name)
return NULL;
}
-static bool pattern_glob(const char *pat, const char *ev)
-{
- while (*pat != '\0' && *ev != '\0') {
- if (*pat == *ev) {
- pat++;
- ev++;
- }
- else if (*pat == '*') {
- if (pattern_glob(pat, ev+1)) {
- return true;
- } else if (pattern_glob(pat+1, ev)) {
- return true;
- } else {
- return false;
- }
- } else {
- return false;
- }
- }
-
- while (*pat == '*') {
- pat++;
- }
-
- if (*pat == '\0' && *ev == '\0') {
- return true;
- } else {
- return false;
- }
-}
-
-
void trace_event_iter_init(TraceEventIter *iter, const char *pattern)
{
iter->event = 0;
@@ -148,8 +116,7 @@ TraceEvent *trace_event_iter_next(TraceEventIter *iter)
iter->group++;
}
if (!iter->pattern ||
- pattern_glob(iter->pattern,
- trace_event_get_name(ev))) {
+ g_pattern_match_simple(iter->pattern, trace_event_get_name(ev))) {
return ev;
}
}
--
2.20.1
- [PULL 12/25] Cleaned up flow of code in qemu_set_log(), to simplify and clarify., (continued)
- [PULL 12/25] Cleaned up flow of code in qemu_set_log(), to simplify and clarify., Alex Bennée, 2019/12/19
- [PULL 13/25] Add a mutex to guarantee single writer to qemu_logfile handle., Alex Bennée, 2019/12/19
- [PULL 18/25] travis.yml: Remove the redundant clang-with-MAIN_SOFTMMU_TARGETS entry, Alex Bennée, 2019/12/19
- [PULL 21/25] linux-user: add target_mmap_complete tracepoint, Alex Bennée, 2019/12/19
- [PULL 15/25] Add use of RCU for qemu_logfile., Alex Bennée, 2019/12/19
- [PULL 20/25] linux-user: convert target_mmap debug to tracepoint, Alex Bennée, 2019/12/19
- [PULL 17/25] docker: gtester is no longer used, Alex Bennée, 2019/12/19
- [PULL 19/25] linux-user: convert target_mprotect debug to tracepoint, Alex Bennée, 2019/12/19
- [PULL 16/25] Added tests for close and change of logfile., Alex Bennée, 2019/12/19
- [PULL 25/25] tests/tcg: ensure we re-configure if configure.sh is updated, Alex Bennée, 2019/12/19
- [PULL 24/25] trace: replace hand-crafted pattern_glob with g_pattern_match_simple,
Alex Bennée <=
- [PULL 23/25] linux-user: convert target_munmap debug to a tracepoint, Alex Bennée, 2019/12/19
- [PULL 22/25] linux-user: log page table changes under -d page, Alex Bennée, 2019/12/19
- [PULL 14/25] qemu_log_lock/unlock now preserves the qemu_logfile handle., Alex Bennée, 2019/12/19
- Re: [PULL 00/25] testing and logging updates, Peter Maydell, 2019/12/20