lyd_free_withsiblings_r(struct lyd_node *first)
{
    struct lyd_node *next, *node;

    LY_TREE_FOR_SAFE(first, next, node) {
        if (node->schema->nodetype & (LYS_CONTAINER | LYS_LIST | LYS_RPC | LYS_ACTION | LYS_NOTIF)) {
            lyd_free_withsiblings_r(node->child);
        }
        _lyd_free_node(node);
    }
}
lyd_free_withsiblings_r(struct lyd_node *first)
{
    struct lyd_node *next, *node;

    LY_TREE_FOR_SAFE(first, next, node) {
        if (node->schema->nodetype & (LYS_CONTAINER | LYS_LIST | LYS_RPC | LYS_ACTION | LYS_NOTIF)) {
            lyd_free_withsiblings_r(node->child);
        }
        _lyd_free_node(node);
    }
}