Skip to content

Commit f0574ac

Browse files
committed
union REFACTOR minor improvements
1 parent 5f20e92 commit f0574ac

File tree

1 file changed

+4
-4
lines changed

1 file changed

+4
-4
lines changed

src/plugins_types/union.c

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -512,16 +512,16 @@ lyplg_type_compare_union(const struct ly_ctx *ctx, const struct lyd_value *val1,
512512
LIBYANG_API_DEF int
513513
lyplg_type_sort_union(const struct ly_ctx *ctx, const struct lyd_value *val1, const struct lyd_value *val2)
514514
{
515-
int rc = LY_SUCCESS;
515+
int rc;
516516
LY_ARRAY_COUNT_TYPE u;
517-
struct lysc_type **types;
518-
struct lysc_type *type;
517+
struct lysc_type **types, *type;
519518

520519
if (val1->subvalue->value.realtype == val2->subvalue->value.realtype) {
521520
return val1->subvalue->value.realtype->plugin->sort(ctx, &val1->subvalue->value, &val2->subvalue->value);
522521
}
523522

524523
/* compare according to the order of types */
524+
rc = 0;
525525
types = ((struct lysc_type_union *)val1->realtype)->types;
526526
LY_ARRAY_FOR(types, u) {
527527
if (types[u]->basetype == LY_TYPE_LEAFREF) {
@@ -538,7 +538,7 @@ lyplg_type_sort_union(const struct ly_ctx *ctx, const struct lyd_value *val1, co
538538
break;
539539
}
540540
}
541-
assert(rc != 0);
541+
assert(rc);
542542

543543
return rc;
544544
}

0 commit comments

Comments
 (0)