aboutsummaryrefslogtreecommitdiff
path: root/src/grecs.h
diff options
context:
space:
mode:
authorSergey Poznyakoff <gray@gnu.org.ua>2012-09-27 14:33:15 +0300
committerSergey Poznyakoff <gray@gnu.org.ua>2012-09-27 14:58:55 +0300
commit784cb941000f13799545e1bb257c899c7da20064 (patch)
tree544512af54e18c0e0fdb8c7a0b011644f93e9539 /src/grecs.h
parent1e658c33ad766e23dffff9125aacef8baebdc30a (diff)
downloadgrecs-784cb941000f13799545e1bb257c899c7da20064.tar.gz
grecs-784cb941000f13799545e1bb257c899c7da20064.tar.bz2
Fix matches in subtrees.
This commit makes it possible to run wildcard matches in subtrees, e.g. like this: grecs_match_first(grecs_find_node(tree, root_path), path, &match_buf); Another effect is that it is possible to use grecs_match_next after a successful recursion using the grecs_node_exact_match. In other words, grecs_match_next works well for both exact and wildcard matches, whatever was the originating node in the tree. (This is used in eclat.) * src/grecs.h (grecs_match_buf_get_root): New proto. (grecs_match_buf_set_root): New proto. * src/lookup.c (grecs_match_buf) <root>: New member. (grecs_match_buf_get_root) (grecs_match_buf_set_root): New functions. (grecs_match): Use root member of struct grecs_match_buf to determine whether we hit root. (grecs_match_buf_first): Initialize root. * src/tree.c (grecs_tree_first_node): Allow for non-root node as argument (no-op in this case). * tests/glob04.at: new testcase. * tests/glob05.at: new testcase. * tests/Makefile.am: Add new files. * tests/testsuite.at: Include new files. * tests/gcfpeek.c: New option "-root", for testing matches in subtrees.
Diffstat (limited to 'src/grecs.h')
-rw-r--r--src/grecs.h2
1 files changed, 2 insertions, 0 deletions
diff --git a/src/grecs.h b/src/grecs.h
index f5fa273..130315a 100644
--- a/src/grecs.h
+++ b/src/grecs.h
@@ -480,6 +480,8 @@ struct grecs_node *grecs_match_buf_first(struct grecs_match_buf *buf,
struct grecs_node *tree);
struct grecs_node *grecs_match_buf_get_node(grecs_match_buf_t buf);
size_t grecs_match_buf_get_args(grecs_match_buf_t buf, char ***argv);
+struct grecs_node *grecs_match_buf_get_root(grecs_match_buf_t buf);
+void grecs_match_buf_set_root(grecs_match_buf_t buf, struct grecs_node *root);
int grecs_value_eq(struct grecs_value *a, struct grecs_value *b);
int grecs_value_match(struct grecs_value *pat, struct grecs_value *b,

Return to:

Send suggestions and report system problems to the System administrator.