diff options
author | Alex Bennée <alex.bennee@linaro.org> | 2019-12-05 12:25:17 +0000 |
---|---|---|
committer | Alex Bennée <alex.bennee@linaro.org> | 2019-12-19 08:20:16 +0000 |
commit | e66eae7a8b8da38daaf0e8a5ac72bd8ee343c2b5 (patch) | |
tree | b3d65a7b7c5d92653195cb40682ea822f83baee6 | |
parent | b7b18d2680ea148a4b5e17e935ef7a68b6d391c2 (diff) | |
download | qemu-e66eae7a8b8da38daaf0e8a5ac72bd8ee343c2b5.zip qemu-e66eae7a8b8da38daaf0e8a5ac72bd8ee343c2b5.tar.gz qemu-e66eae7a8b8da38daaf0e8a5ac72bd8ee343c2b5.tar.bz2 |
trace: replace hand-crafted pattern_glob with g_pattern_match_simple
We already use g_pattern_match elsewhere so remove the duplication.
Signed-off-by: Alex Bennée <alex.bennee@linaro.org>
Reviewed-by: Richard Henderson <richard.henderson@linaro.org>
Reviewed-by: Stefan Hajnoczi <stefanha@redhat.com>
Message-Id: <20191205122518.10010-7-alex.bennee@linaro.org>
-rw-r--r-- | trace/control.c | 35 |
1 files changed, 1 insertions, 34 deletions
diff --git a/trace/control.c b/trace/control.c index d9cafc1..0fb8124 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; } } |