[Pdbg] [PATCH 3/3] path: Avoid a match for nested nodes of the same class
Amitay Isaacs
amitay at ozlabs.org
Thu Mar 14 17:44:49 AEDT 2019
Signed-off-by: Amitay Isaacs <amitay at ozlabs.org>
---
src/path.c | 13 +++++++++++++
1 file changed, 13 insertions(+)
diff --git a/src/path.c b/src/path.c
index a745838..e6c9d94 100644
--- a/src/path.c
+++ b/src/path.c
@@ -270,6 +270,19 @@ static void path_pattern_match(struct pdbg_target *target,
}
}
+ /*
+ * If we find the same class nested which is not a match,
+ * then stop recursion
+ */
+ if (level > 0 && !strcmp(tok, pats[level-1].prefix)) {
+ if (pats[level-1].match_index) {
+ int index = pdbg_target_index(target);
+
+ if (pats[level-1].index[index] != 1)
+ return;
+ }
+ }
+
end:
pdbg_for_each_child_target(target, child) {
path_pattern_match(child, pats, max_levels, next);
--
2.20.1
More information about the Pdbg
mailing list