You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@qpid.apache.org by gm...@apache.org on 2018/02/16 18:58:55 UTC
qpid-dispatch git commit: DISPATCH-889: fix the parse tree token
string comparison
Repository: qpid-dispatch
Updated Branches:
refs/heads/1.0.x afb1b82d5 -> 0e76f1512
DISPATCH-889: fix the parse tree token string comparison
(cherry picked from commit e531e1cff723702952836d369d5d731679f121b9)
Project: http://git-wip-us.apache.org/repos/asf/qpid-dispatch/repo
Commit: http://git-wip-us.apache.org/repos/asf/qpid-dispatch/commit/0e76f151
Tree: http://git-wip-us.apache.org/repos/asf/qpid-dispatch/tree/0e76f151
Diff: http://git-wip-us.apache.org/repos/asf/qpid-dispatch/diff/0e76f151
Branch: refs/heads/1.0.x
Commit: 0e76f1512309dd492244522a38a0cdd7c113c9a7
Parents: afb1b82
Author: Kenneth Giusti <kg...@apache.org>
Authored: Mon Dec 4 12:04:58 2017 -0500
Committer: Ganesh Murthy <gm...@redhat.com>
Committed: Fri Feb 16 13:55:32 2018 -0500
----------------------------------------------------------------------
src/parse_tree.c | 4 +---
tests/parse_tree_tests.c | 11 +++++++++++
2 files changed, 12 insertions(+), 3 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/qpid-dispatch/blob/0e76f151/src/parse_tree.c
----------------------------------------------------------------------
diff --git a/src/parse_tree.c b/src/parse_tree.c
index ac0b116..7ed7c89 100644
--- a/src/parse_tree.c
+++ b/src/parse_tree.c
@@ -91,7 +91,7 @@ static void token_iterator_pop(token_iterator_t *t, token_t *head)
static bool token_match_str(const token_t *t, const char *str)
{
- return !strncmp(t->begin, str, TOKEN_LEN(*t));
+ return (TOKEN_LEN(*t) == strlen(str) && !strncmp(t->begin, str, TOKEN_LEN(*t)));
}
// True if token matches the given char value
@@ -563,8 +563,6 @@ void qd_parse_tree_search(qd_parse_tree_t *node,
char *str = (char *)qd_iterator_copy(dup);
qd_log(node->log_source, QD_LOG_TRACE, "Parse tree search for '%s'", str);
- normalize_pattern(str);
-
token_iterator_init(&t_iter, str);
parse_node_find(node, &t_iter, callback, handle);
http://git-wip-us.apache.org/repos/asf/qpid-dispatch/blob/0e76f151/tests/parse_tree_tests.c
----------------------------------------------------------------------
diff --git a/tests/parse_tree_tests.c b/tests/parse_tree_tests.c
index f029f26..745f18a 100644
--- a/tests/parse_tree_tests.c
+++ b/tests/parse_tree_tests.c
@@ -338,6 +338,17 @@ static char *test_matches(void *context)
};
rc = match_test("*/#/*", test14);
+ match_test_t test15[] = {
+ {"/policy", true},
+ {"/good/policy", true},
+ {"/really/really/good/policy", true},
+ {"help/police", false},
+ {"bad/polic", false},
+ {"/bad/p", false},
+ {NULL, false}
+ };
+ rc = match_test("/#/policy", test15);
+
return rc;
}
---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@qpid.apache.org
For additional commands, e-mail: commits-help@qpid.apache.org