schema CHANGE redesign Sized arrays to be usable in a more simple way
diff --git a/src/tree_schema_helpers.c b/src/tree_schema_helpers.c
index c08068a..0d0620c 100644
--- a/src/tree_schema_helpers.c
+++ b/src/tree_schema_helpers.c
@@ -92,17 +92,16 @@
struct lysp_revision rev;
for (i = 1, r = 0; revs && i < LY_ARRAY_SIZE(revs); i++) {
- if (strcmp(LY_ARRAY_INDEX(revs, i, struct lysp_revision)->rev,
- LY_ARRAY_INDEX(revs, r, struct lysp_revision)->rev) > 0) {
+ if (strcmp(revs[i].rev, revs[r].rev) > 0) {
r = i;
}
}
if (r) {
/* the newest revision is not on position 0, switch them */
- memcpy(&rev, LY_ARRAY_INDEX(revs, 0), sizeof rev);
- memcpy(LY_ARRAY_INDEX(revs, 0), LY_ARRAY_INDEX(revs, r), sizeof rev);
- memcpy(LY_ARRAY_INDEX(revs, r), &rev, sizeof rev);
+ memcpy(&rev, &revs[0], sizeof rev);
+ memcpy(&revs[0], &revs[r], sizeof rev);
+ memcpy(&revs[r], &rev, sizeof rev);
}
}