resolve_schema_leafref_valid_dep_flag(const struct lys_node *op_node, const struct lys_module *local_mod,
                                      const struct lys_node *first_node, int abs_path)
{
    const struct lys_node *node;

    if (!op_node) {
        /* leafref pointing to a different module */
        if (local_mod != lys_node_module(first_node)) {
            return 1;
        }
    } else if (lys_parent(op_node)) {
        /* inner operation (notif/action) */
        if (abs_path) {
            return 1;
        } else {
            /* if first_node parent is not op_node, it is external */
            for (node = first_node; node && (node != op_node); node = lys_parent(node));
            if (!node) {
                return 1;
            }
        }
    } else {
        /* top-level operation (notif/rpc) */
        if (op_node != first_node) {
            return 1;
        }
    }

    return 0;
}
resolve_schema_leafref_valid_dep_flag(const struct lys_node *op_node, const struct lys_module *local_mod,
                                      const struct lys_node *first_node, int abs_path)
{
    const struct lys_node *node;

    if (!op_node) {
         
        if (local_mod != lys_node_module(first_node)) {
            return 1;
        }
    } else if (lys_parent(op_node)) {
         
        if (abs_path) {
            return 1;
        } else {
             
            for (node = first_node; node && (node != op_node); node = lys_parent(node));
            if (!node) {
                return 1;
            }
        }
    } else {
         
        if (op_node != first_node) {
            return 1;
        }
    }

    return 0;
}