diff options
| author | Christian Hopps <chopps@labn.net> | 2024-01-15 07:03:34 -0500 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2024-01-15 07:03:34 -0500 |
| commit | f2bb6874268b271e49ca2acdc5dba5efd2b0b697 (patch) | |
| tree | f44cc26dec9896b45d2a3c4139b1ea30fd2f3e75 /lib/yang.c | |
| parent | bd9174f424bd33e75895160aa1f4a63dae795460 (diff) | |
| parent | 2764344bcbd37c5ea69231d6e51ba9cd58edbb44 (diff) | |
Merge pull request #15154 from idryzhov/mgmt-get-data
mgmtd get-data request expansion
Diffstat (limited to 'lib/yang.c')
| -rw-r--r-- | lib/yang.c | 27 |
1 files changed, 15 insertions, 12 deletions
diff --git a/lib/yang.c b/lib/yang.c index 5b177f7fbc..7d35fb0d3d 100644 --- a/lib/yang.c +++ b/lib/yang.c @@ -1089,7 +1089,7 @@ LY_ERR yang_lyd_trim_xpath(struct lyd_node **root, const char *xpath) } return LY_SUCCESS; #else - struct lyd_node *node; + struct lyd_node *node, *sib; struct lyd_node **remove = NULL; struct ly_set *set = NULL; uint32_t i; @@ -1123,18 +1123,21 @@ LY_ERR yang_lyd_trim_xpath(struct lyd_node **root, const char *xpath) } darr_ensure_cap(remove, 128); - LYD_TREE_DFS_BEGIN (*root, node) { - /* - * If this is a direct matching node then include it's subtree - * which won't be marked and would otherwise be removed. - */ - if (node->priv == (void *)2) - LYD_TREE_DFS_continue = 1; - else if (!node->priv) { - *darr_append(remove) = node; - LYD_TREE_DFS_continue = 1; + LY_LIST_FOR(*root, sib) { + LYD_TREE_DFS_BEGIN (sib, node) { + /* + * If this is a direct matching node then include its + * subtree which won't be marked and would otherwise + * be removed. + */ + if (node->priv == (void *)2) + LYD_TREE_DFS_continue = 1; + else if (!node->priv) { + *darr_append(remove) = node; + LYD_TREE_DFS_continue = 1; + } + LYD_TREE_DFS_END(sib, node); } - LYD_TREE_DFS_END(*root, node); } darr_foreach_i (remove, i) { if (remove[i] == *root) |
