diff options
| author | Renato Westphal <renato@opensourcerouting.org> | 2018-11-02 21:56:26 -0200 |
|---|---|---|
| committer | Renato Westphal <renato@opensourcerouting.org> | 2018-11-26 17:38:08 -0200 |
| commit | e0ccfad220d80c1d02b327fd0ee24faf6a8d2bd4 (patch) | |
| tree | fcfd051fb691b38b615c3c77631dcf4e876060f5 /tools/gen_yang_deviations.c | |
| parent | a1b5f469e70333042c2a0bd7e98bc4e69f4a0237 (diff) | |
lib: rework the yang schema node iteration functions
* Rename yang_snodes_iterate() to yang_snodes_iterate_subtree() and
expose it in the public API.
* Rename yang_module_snodes_iterate() to yang_snodes_iterate_module().
* Rename yang_all_snodes_iterate() to yang_snodes_iterate_all().
* Make it possible to stop the iteration at any time by returning
YANG_ITER_STOP in the iteration callbacks.
* Make the iteration callbacks accept only one user argument and not
two.
Signed-off-by: Renato Westphal <renato@opensourcerouting.org>
Diffstat (limited to 'tools/gen_yang_deviations.c')
| -rw-r--r-- | tools/gen_yang_deviations.c | 9 |
1 files changed, 5 insertions, 4 deletions
diff --git a/tools/gen_yang_deviations.c b/tools/gen_yang_deviations.c index 121969c6fe..f611f1c57e 100644 --- a/tools/gen_yang_deviations.c +++ b/tools/gen_yang_deviations.c @@ -32,8 +32,7 @@ static void __attribute__((noreturn)) usage(int status) exit(status); } -static void generate_yang_deviation(const struct lys_node *snode, void *arg1, - void *arg2) +static int generate_yang_deviation(const struct lys_node *snode, void *arg) { char xpath[XPATH_MAXLEN]; @@ -42,6 +41,8 @@ static void generate_yang_deviation(const struct lys_node *snode, void *arg1, printf(" deviation \"%s\" {\n", xpath); printf(" deviate not-supported;\n"); printf(" }\n\n"); + + return YANG_ITER_CONTINUE; } int main(int argc, char *argv[]) @@ -70,8 +71,8 @@ int main(int argc, char *argv[]) module = yang_module_load(argv[0]); /* Generate deviations. */ - yang_module_snodes_iterate(module->info, generate_yang_deviation, - YANG_ITER_FILTER_IMPLICIT, NULL, NULL); + yang_snodes_iterate_module(module->info, generate_yang_deviation, + YANG_ITER_FILTER_IMPLICIT, NULL); /* Cleanup and exit. */ yang_terminate(); |
