libyang REFACTOR rename sized array size to count
... because it reflects the fact that it may not
always (internally) be the size of the array.
diff --git a/src/tree_schema_compile.c b/src/tree_schema_compile.c
index 14dafbc..4417027 100644
--- a/src/tree_schema_compile.c
+++ b/src/tree_schema_compile.c
@@ -53,9 +53,9 @@
#define COMPILE_ARRAY_GOTO(CTX, ARRAY_P, ARRAY_C, ITER, FUNC, RET, GOTO) \
if (ARRAY_P) { \
- LY_ARRAY_CREATE_GOTO((CTX)->ctx, ARRAY_C, LY_ARRAY_SIZE(ARRAY_P), RET, GOTO); \
- LY_ARRAY_SIZE_TYPE __array_offset = LY_ARRAY_SIZE(ARRAY_C); \
- for (ITER = 0; ITER < LY_ARRAY_SIZE(ARRAY_P); ++ITER) { \
+ LY_ARRAY_CREATE_GOTO((CTX)->ctx, ARRAY_C, LY_ARRAY_COUNT(ARRAY_P), RET, GOTO); \
+ LY_ARRAY_COUNT_TYPE __array_offset = LY_ARRAY_COUNT(ARRAY_C); \
+ for (ITER = 0; ITER < LY_ARRAY_COUNT(ARRAY_P); ++ITER) { \
LY_ARRAY_INCREMENT(ARRAY_C); \
RET = FUNC(CTX, &(ARRAY_P)[ITER], &(ARRAY_C)[ITER + __array_offset]); \
LY_CHECK_GOTO(RET != LY_SUCCESS, GOTO); \
@@ -64,9 +64,9 @@
#define COMPILE_ARRAY1_GOTO(CTX, ARRAY_P, ARRAY_C, PARENT, ITER, FUNC, USES_STATUS, RET, GOTO) \
if (ARRAY_P) { \
- LY_ARRAY_CREATE_GOTO((CTX)->ctx, ARRAY_C, LY_ARRAY_SIZE(ARRAY_P), RET, GOTO); \
- LY_ARRAY_SIZE_TYPE __array_offset = LY_ARRAY_SIZE(ARRAY_C); \
- for (ITER = 0; ITER < LY_ARRAY_SIZE(ARRAY_P); ++ITER) { \
+ LY_ARRAY_CREATE_GOTO((CTX)->ctx, ARRAY_C, LY_ARRAY_COUNT(ARRAY_P), RET, GOTO); \
+ LY_ARRAY_COUNT_TYPE __array_offset = LY_ARRAY_COUNT(ARRAY_C); \
+ for (ITER = 0; ITER < LY_ARRAY_COUNT(ARRAY_P); ++ITER) { \
LY_ARRAY_INCREMENT(ARRAY_C); \
RET = FUNC(CTX, &(ARRAY_P)[ITER], PARENT, &(ARRAY_C)[ITER + __array_offset], USES_STATUS); \
LY_CHECK_GOTO(RET != LY_SUCCESS, GOTO); \
@@ -75,8 +75,8 @@
#define COMPILE_EXTS_GOTO(CTX, EXTS_P, EXT_C, PARENT, PARENT_TYPE, RET, GOTO) \
if (EXTS_P) { \
- LY_ARRAY_CREATE_GOTO((CTX)->ctx, EXT_C, LY_ARRAY_SIZE(EXTS_P), RET, GOTO); \
- for (LY_ARRAY_SIZE_TYPE __exts_iter = 0, __array_offset = LY_ARRAY_SIZE(EXT_C); __exts_iter < LY_ARRAY_SIZE(EXTS_P); ++__exts_iter) { \
+ LY_ARRAY_CREATE_GOTO((CTX)->ctx, EXT_C, LY_ARRAY_COUNT(EXTS_P), RET, GOTO); \
+ for (LY_ARRAY_COUNT_TYPE __exts_iter = 0, __array_offset = LY_ARRAY_COUNT(EXT_C); __exts_iter < LY_ARRAY_COUNT(EXTS_P); ++__exts_iter) { \
LY_ARRAY_INCREMENT(EXT_C); \
RET = lys_compile_ext(CTX, &(EXTS_P)[__exts_iter], &(EXT_C)[__exts_iter + __array_offset], PARENT, PARENT_TYPE, NULL); \
LY_CHECK_GOTO(RET != LY_SUCCESS, GOTO); \
@@ -85,9 +85,9 @@
#define COMPILE_ARRAY_UNIQUE_GOTO(CTX, ARRAY_P, ARRAY_C, ITER, FUNC, RET, GOTO) \
if (ARRAY_P) { \
- LY_ARRAY_CREATE_GOTO((CTX)->ctx, ARRAY_C, LY_ARRAY_SIZE(ARRAY_P), RET, GOTO); \
- LY_ARRAY_SIZE_TYPE __array_offset = LY_ARRAY_SIZE(ARRAY_C); \
- for (ITER = 0; ITER < LY_ARRAY_SIZE(ARRAY_P); ++ITER) { \
+ LY_ARRAY_CREATE_GOTO((CTX)->ctx, ARRAY_C, LY_ARRAY_COUNT(ARRAY_P), RET, GOTO); \
+ LY_ARRAY_COUNT_TYPE __array_offset = LY_ARRAY_COUNT(ARRAY_C); \
+ for (ITER = 0; ITER < LY_ARRAY_COUNT(ARRAY_P); ++ITER) { \
LY_ARRAY_INCREMENT(ARRAY_C); \
RET = FUNC(CTX, &(ARRAY_P)[ITER], ARRAY_C, &(ARRAY_C)[ITER + __array_offset]); \
LY_CHECK_GOTO(RET != LY_SUCCESS, GOTO); \
@@ -105,7 +105,7 @@
#define COMPILE_MEMBER_ARRAY_GOTO(CTX, MEMBER_P, ARRAY_C, FUNC, RET, GOTO) \
if (MEMBER_P) { \
LY_ARRAY_CREATE_GOTO((CTX)->ctx, ARRAY_C, 1, RET, GOTO); \
- LY_ARRAY_SIZE_TYPE __array_offset = LY_ARRAY_SIZE(ARRAY_C); \
+ LY_ARRAY_COUNT_TYPE __array_offset = LY_ARRAY_COUNT(ARRAY_C); \
LY_ARRAY_INCREMENT(ARRAY_C); \
RET = FUNC(CTX, MEMBER_P, &(ARRAY_C)[__array_offset]); \
LY_CHECK_GOTO(RET != LY_SUCCESS, GOTO); \
@@ -113,7 +113,7 @@
#define COMPILE_CHECK_UNIQUENESS_ARRAY(CTX, ARRAY, MEMBER, EXCL, STMT, IDENT) \
if (ARRAY) { \
- for (LY_ARRAY_SIZE_TYPE u__ = 0; u__ < LY_ARRAY_SIZE(ARRAY); ++u__) { \
+ for (LY_ARRAY_COUNT_TYPE u__ = 0; u__ < LY_ARRAY_COUNT(ARRAY); ++u__) { \
if (&(ARRAY)[u__] != EXCL && (void*)((ARRAY)[u__].MEMBER) == (void*)(IDENT)) { \
LOGVAL((CTX)->ctx, LY_VLOG_STR, (CTX)->path, LY_VCODE_DUPIDENT, IDENT, STMT); \
return LY_EVALID; \
@@ -123,7 +123,7 @@
#define COMPILE_CHECK_UNIQUENESS_PARRAY(CTX, ARRAY, MEMBER, EXCL, STMT, IDENT) \
if (ARRAY) { \
- for (LY_ARRAY_SIZE_TYPE u__ = 0; u__ < LY_ARRAY_SIZE(ARRAY); ++u__) { \
+ for (LY_ARRAY_COUNT_TYPE u__ = 0; u__ < LY_ARRAY_COUNT(ARRAY); ++u__) { \
if (&(ARRAY)[u__] != EXCL && (void*)((ARRAY)[u__]->MEMBER) == (void*)(IDENT)) { \
LOGVAL((CTX)->ctx, LY_VLOG_STR, (CTX)->path, LY_VCODE_DUPIDENT, IDENT, STMT); \
return LY_EVALID; \
@@ -278,11 +278,11 @@
lysc_patterns_dup(struct ly_ctx *ctx, struct lysc_pattern **orig)
{
struct lysc_pattern **dup = NULL;
- LY_ARRAY_SIZE_TYPE u;
+ LY_ARRAY_COUNT_TYPE u;
assert(orig);
- LY_ARRAY_CREATE_RET(ctx, dup, LY_ARRAY_SIZE(orig), NULL);
+ LY_ARRAY_CREATE_RET(ctx, dup, LY_ARRAY_COUNT(orig), NULL);
LY_ARRAY_FOR(orig, u) {
dup[u] = lysc_pattern_dup(orig[u]);
LY_ARRAY_INCREMENT(dup);
@@ -309,9 +309,9 @@
dup = calloc(1, sizeof *dup);
LY_CHECK_ERR_RET(!dup, LOGMEM(ctx), NULL);
if (orig->parts) {
- LY_ARRAY_CREATE_GOTO(ctx, dup->parts, LY_ARRAY_SIZE(orig->parts), ret, cleanup);
- LY_ARRAY_SIZE(dup->parts) = LY_ARRAY_SIZE(orig->parts);
- memcpy(dup->parts, orig->parts, LY_ARRAY_SIZE(dup->parts) * sizeof *dup->parts);
+ LY_ARRAY_CREATE_GOTO(ctx, dup->parts, LY_ARRAY_COUNT(orig->parts), ret, cleanup);
+ LY_ARRAY_COUNT(dup->parts) = LY_ARRAY_COUNT(orig->parts);
+ memcpy(dup->parts, orig->parts, LY_ARRAY_COUNT(dup->parts) * sizeof *dup->parts);
}
DUP_STRING(ctx, orig->eapptag, dup->eapptag);
DUP_STRING(ctx, orig->emsg, dup->emsg);
@@ -421,7 +421,7 @@
lys_feature_find(struct lys_module *mod, const char *name, size_t len)
{
size_t i;
- LY_ARRAY_SIZE_TYPE u;
+ LY_ARRAY_COUNT_TYPE u;
struct lysc_feature *f, *flist;
for (i = 0; i < len; ++i) {
@@ -502,7 +502,7 @@
LY_ERR ret = LY_EVALID;
const char *name;
size_t u;
- LY_ARRAY_SIZE_TYPE v;
+ LY_ARRAY_COUNT_TYPE v;
const char *prefixed_name = NULL;
DUP_STRING(ctx->ctx, ext_p->argument, ext->argument);
@@ -952,7 +952,7 @@
lys_identity_precompile(struct lysc_ctx *ctx_sc, struct ly_ctx *ctx, struct lys_module *module,
struct lysp_ident *identities_p, struct lysc_ident **identities)
{
- LY_ARRAY_SIZE_TYPE offset = 0, u, v;
+ LY_ARRAY_COUNT_TYPE offset = 0, u, v;
struct lysc_ctx context = {0};
LY_ERR ret = LY_SUCCESS;
@@ -970,11 +970,11 @@
return LY_SUCCESS;
}
if (*identities) {
- offset = LY_ARRAY_SIZE(*identities);
+ offset = LY_ARRAY_COUNT(*identities);
}
lysc_update_path(ctx_sc, NULL, "{identity}");
- LY_ARRAY_CREATE_RET(ctx_sc->ctx, *identities, LY_ARRAY_SIZE(identities_p), LY_EMEM);
+ LY_ARRAY_CREATE_RET(ctx_sc->ctx, *identities, LY_ARRAY_COUNT(identities_p), LY_EMEM);
LY_ARRAY_FOR(identities_p, u) {
lysc_update_path(ctx_sc, NULL, identities_p[u].name);
@@ -1013,7 +1013,7 @@
lys_compile_identity_circular_check(struct lysc_ctx *ctx, struct lysc_ident *ident, struct lysc_ident **derived)
{
LY_ERR ret = LY_EVALID;
- LY_ARRAY_SIZE_TYPE u, v;
+ LY_ARRAY_COUNT_TYPE u, v;
struct ly_set recursion = {0};
struct lysc_ident *drv;
@@ -1021,7 +1021,7 @@
return LY_SUCCESS;
}
- for (u = 0; u < LY_ARRAY_SIZE(derived); ++u) {
+ for (u = 0; u < LY_ARRAY_COUNT(derived); ++u) {
if (ident == derived[u]) {
LOGVAL(ctx->ctx, LY_VLOG_STR, ctx->path, LYVE_REFERENCE,
"Identity \"%s\" is indirectly derived from itself.", ident->name);
@@ -1035,7 +1035,7 @@
if (!drv->derived) {
continue;
}
- for (u = 0; u < LY_ARRAY_SIZE(drv->derived); ++u) {
+ for (u = 0; u < LY_ARRAY_COUNT(drv->derived); ++u) {
if (ident == drv->derived[u]) {
LOGVAL(ctx->ctx, LY_VLOG_STR, ctx->path, LYVE_REFERENCE,
"Identity \"%s\" is indirectly derived from itself.", ident->name);
@@ -1068,14 +1068,14 @@
lys_compile_identity_bases(struct lysc_ctx *ctx, struct lys_module *context_module, const char **bases_p,
struct lysc_ident *ident, struct lysc_ident ***bases)
{
- LY_ARRAY_SIZE_TYPE u, v;
+ LY_ARRAY_COUNT_TYPE u, v;
const char *s, *name;
struct lys_module *mod;
struct lysc_ident **idref, *identities;
assert(ident || bases);
- if (LY_ARRAY_SIZE(bases_p) > 1 && ctx->mod_def->version < 2) {
+ if (LY_ARRAY_COUNT(bases_p) > 1 && ctx->mod_def->version < 2) {
LOGVAL(ctx->ctx, LY_VLOG_STR, ctx->path, LYVE_SYNTAX_YANG,
"Multiple bases in %s are allowed only in YANG 1.1 modules.", ident ? "identity" : "identityref type");
return LY_EVALID;
@@ -1152,10 +1152,10 @@
static LY_ERR
lys_compile_identities_derived(struct lysc_ctx *ctx, struct lysp_ident *idents_p, struct lysc_ident *idents)
{
- LY_ARRAY_SIZE_TYPE u;
+ LY_ARRAY_COUNT_TYPE u;
lysc_update_path(ctx, NULL, "{identity}");
- for (u = 0; u < LY_ARRAY_SIZE(idents_p); ++u) {
+ for (u = 0; u < LY_ARRAY_COUNT(idents_p); ++u) {
if (!idents_p[u].bases) {
continue;
}
@@ -1171,7 +1171,7 @@
lys_feature_precompile(struct lysc_ctx *ctx_sc, struct ly_ctx *ctx, struct lys_module *module,
struct lysp_feature *features_p, struct lysc_feature **features)
{
- LY_ARRAY_SIZE_TYPE offset = 0, u;
+ LY_ARRAY_COUNT_TYPE offset = 0, u;
struct lysc_ctx context = {0};
assert(ctx_sc || ctx);
@@ -1188,11 +1188,11 @@
return LY_SUCCESS;
}
if (*features) {
- offset = LY_ARRAY_SIZE(*features);
+ offset = LY_ARRAY_COUNT(*features);
}
lysc_update_path(ctx_sc, NULL, "{feature}");
- LY_ARRAY_CREATE_RET(ctx_sc->ctx, *features, LY_ARRAY_SIZE(features_p), LY_EMEM);
+ LY_ARRAY_CREATE_RET(ctx_sc->ctx, *features, LY_ARRAY_COUNT(features_p), LY_EMEM);
LY_ARRAY_FOR(features_p, u) {
lysc_update_path(ctx_sc, NULL, features_p[u].name);
@@ -1227,7 +1227,7 @@
lys_compile_feature_circular_check(struct lysc_ctx *ctx, struct lysc_feature *feature, struct lysc_feature **depfeatures)
{
LY_ERR ret = LY_EVALID;
- LY_ARRAY_SIZE_TYPE u, v;
+ LY_ARRAY_COUNT_TYPE u, v;
struct ly_set recursion = {0};
struct lysc_feature *drv;
@@ -1235,7 +1235,7 @@
return LY_SUCCESS;
}
- for (u = 0; u < LY_ARRAY_SIZE(depfeatures); ++u) {
+ for (u = 0; u < LY_ARRAY_COUNT(depfeatures); ++u) {
if (feature == depfeatures[u]) {
LOGVAL(ctx->ctx, LY_VLOG_STR, ctx->path, LYVE_REFERENCE,
"Feature \"%s\" is indirectly referenced from itself.", feature->name);
@@ -1249,7 +1249,7 @@
if (!drv->depfeatures) {
continue;
}
- for (u = 0; u < LY_ARRAY_SIZE(drv->depfeatures); ++u) {
+ for (u = 0; u < LY_ARRAY_COUNT(drv->depfeatures); ++u) {
if (feature == drv->depfeatures[u]) {
LOGVAL(ctx->ctx, LY_VLOG_STR, ctx->path, LYVE_REFERENCE,
"Feature \"%s\" is indirectly referenced from itself.", feature->name);
@@ -1278,7 +1278,7 @@
static LY_ERR
lys_feature_precompile_finish(struct lysc_ctx *ctx, struct lysp_feature *feature_p, struct lysc_feature *features)
{
- LY_ARRAY_SIZE_TYPE u, v, x;
+ LY_ARRAY_COUNT_TYPE u, v, x;
struct lysc_feature *feature, **df;
LY_ERR ret = LY_SUCCESS;
@@ -1296,9 +1296,9 @@
COMPILE_EXTS_GOTO(ctx, feature_p->exts, feature->exts, feature, LYEXT_PAR_FEATURE, ret, done);
COMPILE_ARRAY_GOTO(ctx, feature_p->iffeatures, feature->iffeatures, u, lys_compile_iffeature, ret, done);
if (feature->iffeatures) {
- for (u = 0; u < LY_ARRAY_SIZE(feature->iffeatures); ++u) {
+ for (u = 0; u < LY_ARRAY_COUNT(feature->iffeatures); ++u) {
if (feature->iffeatures[u].features) {
- for (v = 0; v < LY_ARRAY_SIZE(feature->iffeatures[u].features); ++v) {
+ for (v = 0; v < LY_ARRAY_COUNT(feature->iffeatures[u].features); ++v) {
/* check for circular dependency - direct reference first,... */
if (feature == feature->iffeatures[u].features[v]) {
LOGVAL(ctx->ctx, LY_VLOG_STR, ctx->path, LYVE_REFERENCE,
@@ -1338,7 +1338,7 @@
static void
lys_feature_precompile_revert(struct lysc_ctx *ctx, struct lys_module *mod)
{
- LY_ARRAY_SIZE_TYPE u, v;
+ LY_ARRAY_COUNT_TYPE u, v;
/* keep the dis_features list until the complete lys_module is freed */
mod->dis_features = mod->compiled->features;
@@ -1494,7 +1494,7 @@
}
if (!valcopy && base_range) {
if (max) {
- part->max_64 = base_range->parts[LY_ARRAY_SIZE(base_range->parts) - 1].max_64;
+ part->max_64 = base_range->parts[LY_ARRAY_COUNT(base_range->parts) - 1].max_64;
} else {
part->min_64 = base_range->parts[0].min_64;
}
@@ -1651,7 +1651,7 @@
const char *expr;
struct lysc_range_part *parts = NULL, *part;
int range_expected = 0, uns;
- LY_ARRAY_SIZE_TYPE parts_done = 0, u, v;
+ LY_ARRAY_COUNT_TYPE parts_done = 0, u, v;
assert(range);
assert(range_p);
@@ -1666,7 +1666,7 @@
"Invalid %s restriction - unexpected end of the expression after \"..\" (%s).",
length_restr ? "length" : "range", range_p->arg);
goto cleanup;
- } else if (!parts || parts_done == LY_ARRAY_SIZE(parts)) {
+ } else if (!parts || parts_done == LY_ARRAY_COUNT(parts)) {
LOGVAL(ctx->ctx, LY_VLOG_STR, ctx->path, LYVE_SYNTAX_YANG,
"Invalid %s restriction - unexpected end of the expression (%s).",
length_restr ? "length" : "range", range_p->arg);
@@ -1701,7 +1701,7 @@
while (isspace(*expr)) {
expr++;
}
- if (!parts || LY_ARRAY_SIZE(parts) == parts_done) {
+ if (!parts || LY_ARRAY_COUNT(parts) == parts_done) {
LOGVAL(ctx->ctx, LY_VLOG_STR, ctx->path, LYVE_SYNTAX_YANG,
"Invalid %s restriction - unexpected \"..\" without a lower bound.", length_restr ? "length" : "range");
goto cleanup;
@@ -1711,12 +1711,12 @@
} else if (isdigit(*expr) || (*expr == '-') || (*expr == '+')) {
/* number */
if (range_expected) {
- part = &parts[LY_ARRAY_SIZE(parts) - 1];
+ part = &parts[LY_ARRAY_COUNT(parts) - 1];
LY_CHECK_GOTO(range_part_minmax(ctx, part, 1, part->min_64, basetype, 0, length_restr, frdigits, NULL, &expr), cleanup);
range_expected = 0;
} else {
LY_ARRAY_NEW_GOTO(ctx->ctx, parts, part, ret, cleanup);
- LY_CHECK_GOTO(range_part_minmax(ctx, part, 0, parts_done ? parts[LY_ARRAY_SIZE(parts) - 2].max_64 : 0,
+ LY_CHECK_GOTO(range_part_minmax(ctx, part, 0, parts_done ? parts[LY_ARRAY_COUNT(parts) - 2].max_64 : 0,
basetype, parts_done ? 0 : 1, length_restr, frdigits, NULL, &expr), cleanup);
part->max_64 = part->min_64;
}
@@ -1733,12 +1733,12 @@
goto cleanup;
}
if (range_expected) {
- part = &parts[LY_ARRAY_SIZE(parts) - 1];
+ part = &parts[LY_ARRAY_COUNT(parts) - 1];
LY_CHECK_GOTO(range_part_minmax(ctx, part, 1, part->min_64, basetype, 0, length_restr, frdigits, base_range, NULL), cleanup);
range_expected = 0;
} else {
LY_ARRAY_NEW_GOTO(ctx->ctx, parts, part, ret, cleanup);
- LY_CHECK_GOTO(range_part_minmax(ctx, part, 1, parts_done ? parts[LY_ARRAY_SIZE(parts) - 2].max_64 : 0,
+ LY_CHECK_GOTO(range_part_minmax(ctx, part, 1, parts_done ? parts[LY_ARRAY_COUNT(parts) - 2].max_64 : 0,
basetype, parts_done ? 0 : 1, length_restr, frdigits, base_range, NULL), cleanup);
part->min_64 = part->max_64;
}
@@ -1772,7 +1772,7 @@
ret = LY_EINT;
goto cleanup;
}
- for (u = v = 0; u < parts_done && v < LY_ARRAY_SIZE(base_range->parts); ++u) {
+ for (u = v = 0; u < parts_done && v < LY_ARRAY_COUNT(base_range->parts); ++u) {
if ((uns && parts[u].min_u64 < base_range->parts[v].min_u64) || (!uns && parts[u].min_64 < base_range->parts[v].min_64)) {
goto baseerror;
}
@@ -2119,7 +2119,7 @@
struct lysc_pattern **base_patterns, struct lysc_pattern ***patterns)
{
struct lysc_pattern **pattern;
- LY_ARRAY_SIZE_TYPE u;
+ LY_ARRAY_COUNT_TYPE u;
LY_ERR ret = LY_SUCCESS;
/* first, copy the patterns from the base type */
@@ -2198,7 +2198,7 @@
struct lysc_type_bitenum_item *base_enums, struct lysc_type_bitenum_item **enums)
{
LY_ERR ret = LY_SUCCESS;
- LY_ARRAY_SIZE_TYPE u, v, match = 0;
+ LY_ARRAY_COUNT_TYPE u, v, match = 0;
int32_t value = 0;
uint32_t position = 0;
struct lysc_type_bitenum_item *e, storage;
@@ -2222,7 +2222,7 @@
break;
}
}
- if (v == LY_ARRAY_SIZE(base_enums)) {
+ if (v == LY_ARRAY_COUNT(base_enums)) {
LOGVAL(ctx->ctx, LY_VLOG_STR, ctx->path, LYVE_SYNTAX_YANG,
"Invalid %s - derived type adds new item \"%s\".",
basetype == LY_TYPE_ENUM ? "enumeration" : "bits", e->name);
@@ -2239,7 +2239,7 @@
value = e->value + 1;
}
/* check collision with other values */
- for (v = 0; v < LY_ARRAY_SIZE(*enums) - 1; ++v) {
+ for (v = 0; v < LY_ARRAY_COUNT(*enums) - 1; ++v) {
if (e->value == (*enums)[v].value) {
LOGVAL(ctx->ctx, LY_VLOG_STR, ctx->path, LYVE_SYNTAX_YANG,
"Invalid enumeration - value %d collide in items \"%s\" and \"%s\".",
@@ -2271,7 +2271,7 @@
position = (uint32_t)e->value + 1;
}
/* check collision with other values */
- for (v = 0; v < LY_ARRAY_SIZE(*enums) - 1; ++v) {
+ for (v = 0; v < LY_ARRAY_COUNT(*enums) - 1; ++v) {
if (e->value == (*enums)[v].value) {
LOGVAL(ctx->ctx, LY_VLOG_STR, ctx->path, LYVE_SYNTAX_YANG,
"Invalid bits - position %u collide in items \"%s\" and \"%s\".",
@@ -2424,7 +2424,7 @@
{
LY_ERR ret = LY_EVALID;
const struct lysc_node *iter;
- LY_ARRAY_SIZE_TYPE u, v, count;
+ LY_ARRAY_COUNT_TYPE u, v, count;
struct ly_set features = {0};
for (iter = refnode; iter; iter = iter->parent) {
@@ -2781,18 +2781,18 @@
return LY_EVALID;
}
/* compile the type */
- LY_ARRAY_CREATE_RET(ctx->ctx, un->types, LY_ARRAY_SIZE(type_p->types), LY_EVALID);
- for (LY_ARRAY_SIZE_TYPE u = 0, additional = 0; u < LY_ARRAY_SIZE(type_p->types); ++u) {
+ LY_ARRAY_CREATE_RET(ctx->ctx, un->types, LY_ARRAY_COUNT(type_p->types), LY_EVALID);
+ for (LY_ARRAY_COUNT_TYPE u = 0, additional = 0; u < LY_ARRAY_COUNT(type_p->types); ++u) {
LY_CHECK_RET(lys_compile_type(ctx, context_node_p, context_flags, context_mod, context_name,
&type_p->types[u], &un->types[u + additional], NULL));
if (un->types[u + additional]->basetype == LY_TYPE_UNION) {
/* add space for additional types from the union subtype */
un_aux = (struct lysc_type_union *)un->types[u + additional];
- LY_ARRAY_RESIZE_ERR_RET(ctx->ctx, un->types, (*((uint64_t*)(type_p->types) - 1)) + additional + LY_ARRAY_SIZE(un_aux->types) - 1,
+ LY_ARRAY_RESIZE_ERR_RET(ctx->ctx, un->types, (*((uint64_t*)(type_p->types) - 1)) + additional + LY_ARRAY_COUNT(un_aux->types) - 1,
lysc_type_free(ctx->ctx, (struct lysc_type*)un_aux), LY_EMEM);
/* copy subtypes of the subtype union */
- for (LY_ARRAY_SIZE_TYPE v = 0; v < LY_ARRAY_SIZE(un_aux->types); ++v) {
+ for (LY_ARRAY_COUNT_TYPE v = 0; v < LY_ARRAY_COUNT(un_aux->types); ++v) {
if (un_aux->types[v]->basetype == LY_TYPE_LEAFREF) {
/* duplicate the whole structure because of the instance-specific path resolving for realtype */
un->types[u + additional] = calloc(1, sizeof(struct lysc_type_leafref));
@@ -3179,7 +3179,7 @@
const struct lysc_notif *notifs, const char *name, void *exclude)
{
const struct lysc_node *iter;
- LY_ARRAY_SIZE_TYPE u;
+ LY_ARRAY_COUNT_TYPE u;
LY_LIST_FOR(children, iter) {
if (iter != exclude && iter->module == ctx->mod && !strcmp(name, iter->name)) {
@@ -3434,7 +3434,7 @@
/* store to validate the path in the current context at the end of schema compiling when all the nodes are present */
ly_set_add(&ctx->leafrefs, leaf, 0);
} else if (leaf->type->basetype == LY_TYPE_UNION) {
- LY_ARRAY_SIZE_TYPE u;
+ LY_ARRAY_COUNT_TYPE u;
LY_ARRAY_FOR(((struct lysc_type_union*)leaf->type)->types, u) {
if (((struct lysc_type_union*)leaf->type)->types[u]->basetype == LY_TYPE_LEAFREF) {
/* store to validate the path in the current context at the end of schema compiling when all the nodes are present */
@@ -3530,7 +3530,7 @@
{
struct lysp_node_leaflist *llist_p = (struct lysp_node_leaflist*)node_p;
struct lysc_node_leaflist *llist = (struct lysc_node_leaflist*)node;
- LY_ARRAY_SIZE_TYPE u, v;
+ LY_ARRAY_COUNT_TYPE u, v;
LY_ERR ret = LY_SUCCESS;
COMPILE_ARRAY_GOTO(ctx, llist_p->musts, llist->musts, u, lys_compile_must, ret, done);
@@ -3556,8 +3556,8 @@
if (llist_p->dflts) {
llist->dflts = NULL; /* reset the temporary llist_p->dflts */
- LY_ARRAY_CREATE_GOTO(ctx->ctx, llist->dflts_mods, LY_ARRAY_SIZE(llist_p->dflts), ret, done);
- LY_ARRAY_CREATE_GOTO(ctx->ctx, llist->dflts, LY_ARRAY_SIZE(llist_p->dflts), ret, done);
+ LY_ARRAY_CREATE_GOTO(ctx->ctx, llist->dflts_mods, LY_ARRAY_COUNT(llist_p->dflts), ret, done);
+ LY_ARRAY_CREATE_GOTO(ctx->ctx, llist->dflts, LY_ARRAY_COUNT(llist_p->dflts), ret, done);
LY_ARRAY_FOR(llist_p->dflts, u) {
struct ly_err_item *err = NULL;
LY_ARRAY_INCREMENT(llist->dflts_mods);
@@ -3586,10 +3586,10 @@
}
llist->flags |= LYS_SET_DFLT;
}
- if ((llist->flags & LYS_CONFIG_W) && llist->dflts && LY_ARRAY_SIZE(llist->dflts)) {
+ if ((llist->flags & LYS_CONFIG_W) && llist->dflts && LY_ARRAY_COUNT(llist->dflts)) {
/* configuration data values must be unique - so check the default values */
LY_ARRAY_FOR(llist->dflts, u) {
- for (v = u + 1; v < LY_ARRAY_SIZE(llist->dflts); ++v) {
+ for (v = u + 1; v < LY_ARRAY_COUNT(llist->dflts); ++v) {
if (!llist->type->plugin->compare(llist->dflts[u], llist->dflts[v])) {
int dynamic = 0;
const char *val = llist->type->plugin->print(llist->dflts[v], LYD_XML, lys_get_prefix, llist->dflts_mods[v], &dynamic);
@@ -3632,11 +3632,11 @@
struct lysc_node *parent;
const char *keystr, *delim;
size_t len;
- LY_ARRAY_SIZE_TYPE v;
+ LY_ARRAY_COUNT_TYPE v;
int config;
uint16_t flags;
- for (v = 0; v < LY_ARRAY_SIZE(uniques); ++v) {
+ for (v = 0; v < LY_ARRAY_COUNT(uniques); ++v) {
config = -1;
LY_ARRAY_NEW_RET(ctx->ctx, list->uniques, unique, LY_EMEM);
keystr = uniques[v];
@@ -4286,7 +4286,7 @@
static void
lys_compile_augment_sort_(struct lysp_augment *aug_p, struct lysp_augment **result)
{
- LY_ARRAY_SIZE_TYPE v;
+ LY_ARRAY_COUNT_TYPE v;
size_t len;
len = strlen(aug_p->nodeid);
@@ -4294,9 +4294,9 @@
if (strlen(result[v]->nodeid) <= len) {
continue;
}
- if (v < LY_ARRAY_SIZE(result)) {
+ if (v < LY_ARRAY_COUNT(result)) {
/* move the rest of array */
- memmove(&result[v + 1], &result[v], (LY_ARRAY_SIZE(result) - v) * sizeof *result);
+ memmove(&result[v + 1], &result[v], (LY_ARRAY_COUNT(result) - v) * sizeof *result);
break;
}
}
@@ -4321,17 +4321,17 @@
lys_compile_augment_sort(struct lysc_ctx *ctx, struct lysp_augment *aug_p, struct lysp_include *inc_p, struct lysp_augment ***augments)
{
struct lysp_augment **result = NULL;
- LY_ARRAY_SIZE_TYPE u, v, count = 0;
+ LY_ARRAY_COUNT_TYPE u, v, count = 0;
assert(augments);
/* get count of the augments in module and all its submodules */
if (aug_p) {
- count += LY_ARRAY_SIZE(aug_p);
+ count += LY_ARRAY_COUNT(aug_p);
}
LY_ARRAY_FOR(inc_p, u) {
if (inc_p[u].submodule->augments) {
- count += LY_ARRAY_SIZE(inc_p[u].submodule->augments);
+ count += LY_ARRAY_COUNT(inc_p[u].submodule->augments);
}
}
@@ -4626,7 +4626,7 @@
.prev = (struct lysc_node*)&context_node_fake,
.actions = NULL, .notifs = NULL};
struct lysp_grp *grp = NULL;
- LY_ARRAY_SIZE_TYPE u, v;
+ LY_ARRAY_COUNT_TYPE u, v;
uint32_t grp_stack_count;
int found;
const char *id, *name, *prefix;
@@ -4639,7 +4639,7 @@
struct ly_set refined = {0};
struct lysc_when **when, *when_shared;
struct lysp_augment **augments = NULL;
- LY_ARRAY_SIZE_TYPE actions_index = 0, notifs_index = 0;
+ LY_ARRAY_COUNT_TYPE actions_index = 0, notifs_index = 0;
struct lysc_notif **notifs = NULL;
struct lysc_action **actions = NULL;
@@ -4673,7 +4673,7 @@
/* search in top-level groupings of the main module ... */
grp = mod->parsed->groupings;
if (grp) {
- for (u = 0; !found && u < LY_ARRAY_SIZE(grp); ++u) {
+ for (u = 0; !found && u < LY_ARRAY_COUNT(grp); ++u) {
if (!strcmp(grp[u].name, name)) {
grp = &grp[u];
found = 1;
@@ -4682,10 +4682,10 @@
}
if (!found && mod->parsed->includes) {
/* ... and all the submodules */
- for (u = 0; !found && u < LY_ARRAY_SIZE(mod->parsed->includes); ++u) {
+ for (u = 0; !found && u < LY_ARRAY_COUNT(mod->parsed->includes); ++u) {
grp = mod->parsed->includes[u].submodule->groupings;
if (grp) {
- for (v = 0; !found && v < LY_ARRAY_SIZE(grp); ++v) {
+ for (v = 0; !found && v < LY_ARRAY_COUNT(grp); ++v) {
if (!strcmp(grp[v].name, name)) {
grp = &grp[v];
found = 1;
@@ -4777,26 +4777,26 @@
/* compile actions */
actions = parent ? lysc_node_actions_p(parent) : &ctx->mod->compiled->rpcs;
if (actions) {
- actions_index = *actions ? LY_ARRAY_SIZE(*actions) : 0;
+ actions_index = *actions ? LY_ARRAY_COUNT(*actions) : 0;
COMPILE_ARRAY1_GOTO(ctx, grp->actions, *actions, parent, u, lys_compile_action, 0, ret, cleanup);
if (*actions && (uses_p->augments || uses_p->refines)) {
/* but for augment and refine, we need to separate the compiled grouping's actions to avoid modification of others */
- LY_ARRAY_CREATE_GOTO(ctx->ctx, context_node_fake.actions, LY_ARRAY_SIZE(*actions) - actions_index, ret, cleanup);
- LY_ARRAY_SIZE(context_node_fake.actions) = LY_ARRAY_SIZE(*actions) - actions_index;
- memcpy(context_node_fake.actions, &(*actions)[actions_index], LY_ARRAY_SIZE(context_node_fake.actions) * sizeof **actions);
+ LY_ARRAY_CREATE_GOTO(ctx->ctx, context_node_fake.actions, LY_ARRAY_COUNT(*actions) - actions_index, ret, cleanup);
+ LY_ARRAY_COUNT(context_node_fake.actions) = LY_ARRAY_COUNT(*actions) - actions_index;
+ memcpy(context_node_fake.actions, &(*actions)[actions_index], LY_ARRAY_COUNT(context_node_fake.actions) * sizeof **actions);
}
}
/* compile notifications */
notifs = parent ? lysc_node_notifs_p(parent) : &ctx->mod->compiled->notifs;
if (notifs) {
- notifs_index = *notifs ? LY_ARRAY_SIZE(*notifs) : 0;
+ notifs_index = *notifs ? LY_ARRAY_COUNT(*notifs) : 0;
COMPILE_ARRAY1_GOTO(ctx, grp->notifs, *notifs, parent, u, lys_compile_notif, 0, ret, cleanup);
if (*notifs && (uses_p->augments || uses_p->refines)) {
/* but for augment and refine, we need to separate the compiled grouping's notification to avoid modification of others */
- LY_ARRAY_CREATE_GOTO(ctx->ctx, context_node_fake.notifs, LY_ARRAY_SIZE(*notifs) - notifs_index, ret, cleanup);
- LY_ARRAY_SIZE(context_node_fake.notifs) = LY_ARRAY_SIZE(*notifs) - notifs_index;
- memcpy(context_node_fake.notifs, &(*notifs)[notifs_index], LY_ARRAY_SIZE(context_node_fake.notifs) * sizeof **notifs);
+ LY_ARRAY_CREATE_GOTO(ctx->ctx, context_node_fake.notifs, LY_ARRAY_COUNT(*notifs) - notifs_index, ret, cleanup);
+ LY_ARRAY_COUNT(context_node_fake.notifs) = LY_ARRAY_COUNT(*notifs) - notifs_index;
+ memcpy(context_node_fake.notifs, &(*notifs)[notifs_index], LY_ARRAY_COUNT(context_node_fake.notifs) * sizeof **notifs);
}
}
@@ -4822,10 +4822,10 @@
/* default value */
if (rfn->dflts) {
- if ((node->nodetype != LYS_LEAFLIST) && LY_ARRAY_SIZE(rfn->dflts) > 1) {
+ if ((node->nodetype != LYS_LEAFLIST) && LY_ARRAY_COUNT(rfn->dflts) > 1) {
LOGVAL(ctx->ctx, LY_VLOG_STR, ctx->path, LYVE_SEMANTICS,
- "Invalid refine of default - %s cannot hold %"LY_PRI_ARRAY_SIZE_TYPE" default values.",
- lys_nodetype2str(node->nodetype), LY_ARRAY_SIZE(rfn->dflts));
+ "Invalid refine of default - %s cannot hold %"LY_PRI_ARRAY_COUNT_TYPE" default values.",
+ lys_nodetype2str(node->nodetype), LY_ARRAY_COUNT(rfn->dflts));
goto cleanup;
}
if (!(node->nodetype & (LYS_LEAF | LYS_LEAFLIST | LYS_CHOICE))) {
@@ -4890,8 +4890,8 @@
llist->dflts_mods = NULL;
/* create the new set of the default values */
- LY_ARRAY_CREATE_GOTO(ctx->ctx, llist->dflts_mods, LY_ARRAY_SIZE(rfn->dflts), ret, cleanup);
- LY_ARRAY_CREATE_GOTO(ctx->ctx, llist->dflts, LY_ARRAY_SIZE(rfn->dflts), ret, cleanup);
+ LY_ARRAY_CREATE_GOTO(ctx->ctx, llist->dflts_mods, LY_ARRAY_COUNT(rfn->dflts), ret, cleanup);
+ LY_ARRAY_CREATE_GOTO(ctx->ctx, llist->dflts, LY_ARRAY_COUNT(rfn->dflts), ret, cleanup);
LY_ARRAY_FOR(rfn->dflts, u) {
struct ly_err_item *err = NULL;
LY_ARRAY_INCREMENT(llist->dflts_mods);
@@ -5091,11 +5091,11 @@
if (uses_p->augments || uses_p->refines) {
/* return back actions and notifications in case they were separated for augment/refine processing */
if (context_node_fake.actions) {
- memcpy(&(*actions)[actions_index], context_node_fake.actions, LY_ARRAY_SIZE(context_node_fake.actions) * sizeof **actions);
+ memcpy(&(*actions)[actions_index], context_node_fake.actions, LY_ARRAY_COUNT(context_node_fake.actions) * sizeof **actions);
LY_ARRAY_FREE(context_node_fake.actions);
}
if (context_node_fake.notifs) {
- memcpy(&(*notifs)[notifs_index], context_node_fake.notifs, LY_ARRAY_SIZE(context_node_fake.notifs) * sizeof **notifs);
+ memcpy(&(*notifs)[notifs_index], context_node_fake.notifs, LY_ARRAY_COUNT(context_node_fake.notifs) * sizeof **notifs);
LY_ARRAY_FREE(context_node_fake.notifs);
}
}
@@ -5530,7 +5530,7 @@
struct lysp_deviate_add *d_add;
struct lysp_deviate_del *d_del;
struct lysp_deviate_rpl *d_rpl;
- LY_ARRAY_SIZE_TYPE u, v, x, y, z;
+ LY_ARRAY_COUNT_TYPE u, v, x, y, z;
struct lysc_deviation {
const char *nodeid;
struct lysc_node *target; /* target node of the deviation */
@@ -5612,9 +5612,9 @@
}
#define DEV_CHECK_CARDINALITY(ARRAY, MAX, PROPERTY) \
- if (LY_ARRAY_SIZE(ARRAY) > MAX) { \
- LOGVAL(ctx->ctx, LY_VLOG_STR, ctx->path, LYVE_SEMANTICS, "Invalid deviation of %s with too many (%"LY_PRI_ARRAY_SIZE_TYPE") %s properties.", \
- lys_nodetype2str(devs[u]->target->nodetype), LY_ARRAY_SIZE(ARRAY), PROPERTY); \
+ if (LY_ARRAY_COUNT(ARRAY) > MAX) { \
+ LOGVAL(ctx->ctx, LY_VLOG_STR, ctx->path, LYVE_SEMANTICS, "Invalid deviation of %s with too many (%"LY_PRI_ARRAY_COUNT_TYPE") %s properties.", \
+ lys_nodetype2str(devs[u]->target->nodetype), LY_ARRAY_COUNT(ARRAY), PROPERTY); \
goto cleanup; \
}
@@ -5665,7 +5665,7 @@
LY_ARRAY_FOR(((TYPE)devs[u]->target)->ARRAY_TRG, y) { \
if (!strcmp(((TYPE)devs[u]->target)->ARRAY_TRG[y]VALMEMBER_CMP, d_del->ARRAY_DEV[x]VALMEMBER)) { break; } \
} \
- if (y == LY_ARRAY_SIZE(((TYPE)devs[u]->target)->ARRAY_TRG)) { \
+ if (y == LY_ARRAY_COUNT(((TYPE)devs[u]->target)->ARRAY_TRG)) { \
LOGVAL(ctx->ctx, LY_VLOG_STR, ctx->path, LYVE_REFERENCE, \
"Invalid deviation deleting \"%s\" property \"%s\" which does not match any of the target's property values.", \
PROPERTY, d_del->ARRAY_DEV[x]VALMEMBER); \
@@ -5675,9 +5675,9 @@
DELFUNC(ctx->ctx, DELFUNC_DEREF((TYPE)devs[u]->target)->ARRAY_TRG[y]); \
memmove(&((TYPE)devs[u]->target)->ARRAY_TRG[y], \
&((TYPE)devs[u]->target)->ARRAY_TRG[y + 1], \
- (LY_ARRAY_SIZE(((TYPE)devs[u]->target)->ARRAY_TRG) - y) * (sizeof *((TYPE)devs[u]->target)->ARRAY_TRG)); \
+ (LY_ARRAY_COUNT(((TYPE)devs[u]->target)->ARRAY_TRG) - y) * (sizeof *((TYPE)devs[u]->target)->ARRAY_TRG)); \
} \
- if (!LY_ARRAY_SIZE(((TYPE)devs[u]->target)->ARRAY_TRG)) { \
+ if (!LY_ARRAY_COUNT(((TYPE)devs[u]->target)->ARRAY_TRG)) { \
LY_ARRAY_FREE(((TYPE)devs[u]->target)->ARRAY_TRG); \
((TYPE)devs[u]->target)->ARRAY_TRG = NULL; \
}
@@ -5704,9 +5704,9 @@
/* not-supported */
if (devs[u]->not_supported) {
- if (LY_ARRAY_SIZE(devs[u]->deviates) > 1) {
- LOGWRN(ctx->ctx, "Useless multiple (%"LY_PRI_ARRAY_SIZE_TYPE") deviates on node \"%s\" since the node is not-supported.",
- LY_ARRAY_SIZE(devs[u]->deviates), devs[u]->nodeid);
+ if (LY_ARRAY_COUNT(devs[u]->deviates) > 1) {
+ LOGWRN(ctx->ctx, "Useless multiple (%"LY_PRI_ARRAY_COUNT_TYPE") deviates on node \"%s\" since the node is not-supported.",
+ LY_ARRAY_COUNT(devs[u]->deviates), devs[u]->nodeid);
}
#define REMOVE_NONDATA(ARRAY, TYPE, GETFUNC, FREEFUNC) \
@@ -5718,9 +5718,9 @@
LY_ARRAY_FOR(ARRAY, x) { \
if (&ARRAY[x] == (TYPE*)devs[u]->target) { break; } \
} \
- if (x < LY_ARRAY_SIZE(ARRAY)) { \
+ if (x < LY_ARRAY_COUNT(ARRAY)) { \
FREEFUNC(ctx->ctx, &ARRAY[x]); \
- memmove(&ARRAY[x], &ARRAY[x + 1], (LY_ARRAY_SIZE(ARRAY) - (x + 1)) * sizeof *ARRAY); \
+ memmove(&ARRAY[x], &ARRAY[x + 1], (LY_ARRAY_COUNT(ARRAY) - (x + 1)) * sizeof *ARRAY); \
LY_ARRAY_DECREMENT(ARRAY); \
}
@@ -5851,10 +5851,10 @@
llist->dflts_mods = NULL;
}
/* add new default value(s) */
- LY_ARRAY_CREATE_GOTO(ctx->ctx, llist->dflts_mods, LY_ARRAY_SIZE(d_add->dflts), ret, cleanup);
- LY_ARRAY_CREATE_GOTO(ctx->ctx, llist->dflts, LY_ARRAY_SIZE(d_add->dflts), ret, cleanup);
- for (x = y = LY_ARRAY_SIZE(llist->dflts);
- x < LY_ARRAY_SIZE(d_add->dflts) + y; ++x) {
+ LY_ARRAY_CREATE_GOTO(ctx->ctx, llist->dflts_mods, LY_ARRAY_COUNT(d_add->dflts), ret, cleanup);
+ LY_ARRAY_CREATE_GOTO(ctx->ctx, llist->dflts, LY_ARRAY_COUNT(d_add->dflts), ret, cleanup);
+ for (x = y = LY_ARRAY_COUNT(llist->dflts);
+ x < LY_ARRAY_COUNT(d_add->dflts) + y; ++x) {
LY_ARRAY_INCREMENT(llist->dflts_mods);
llist->dflts_mods[x] = ctx->mod_def;
LY_ARRAY_INCREMENT(llist->dflts);
@@ -6042,19 +6042,19 @@
/* complete match - remove the unique */
LY_ARRAY_DECREMENT(list->uniques);
LY_ARRAY_FREE(list->uniques[z]);
- memmove(&list->uniques[z], &list->uniques[z + 1], (LY_ARRAY_SIZE(list->uniques) - z) * (sizeof *list->uniques));
+ memmove(&list->uniques[z], &list->uniques[z + 1], (LY_ARRAY_COUNT(list->uniques) - z) * (sizeof *list->uniques));
--z;
break;
}
}
- if (!list->uniques || z == LY_ARRAY_SIZE(list->uniques)) {
+ if (!list->uniques || z == LY_ARRAY_COUNT(list->uniques)) {
LOGVAL(ctx->ctx, LY_VLOG_STR, ctx->path, LYVE_REFERENCE,
"Invalid deviation deleting \"unique\" property \"%s\" which does not match any of the target's property values.",
d_del->uniques[x]);
goto cleanup;
}
}
- if (!LY_ARRAY_SIZE(list->uniques)) {
+ if (!LY_ARRAY_COUNT(list->uniques)) {
LY_ARRAY_FREE(list->uniques);
list->uniques = NULL;
}
@@ -6112,7 +6112,7 @@
}
dflt = NULL;
}
- if (y == LY_ARRAY_SIZE(llist->dflts)) {
+ if (y == LY_ARRAY_COUNT(llist->dflts)) {
LOGVAL(ctx->ctx, LY_VLOG_STR, ctx->path, LYVE_REFERENCE, "Invalid deviation deleting \"default\" property \"%s\" "
"which does not match any of the target's property values.", d_del->dflts[x]);
goto cleanup;
@@ -6126,10 +6126,10 @@
llist->dflts[y]->realtype->plugin->free(ctx->ctx, llist->dflts[y]);
lysc_type_free(ctx->ctx, llist->dflts[y]->realtype);
free(llist->dflts[y]);
- memmove(&llist->dflts[y], &llist->dflts[y + 1], (LY_ARRAY_SIZE(llist->dflts) - y) * (sizeof *llist->dflts));
- memmove(&llist->dflts_mods[y], &llist->dflts_mods[y + 1], (LY_ARRAY_SIZE(llist->dflts_mods) - y) * (sizeof *llist->dflts_mods));
+ memmove(&llist->dflts[y], &llist->dflts[y + 1], (LY_ARRAY_COUNT(llist->dflts) - y) * (sizeof *llist->dflts));
+ memmove(&llist->dflts_mods[y], &llist->dflts_mods[y + 1], (LY_ARRAY_COUNT(llist->dflts_mods) - y) * (sizeof *llist->dflts_mods));
}
- if (!LY_ARRAY_SIZE(llist->dflts)) {
+ if (!LY_ARRAY_COUNT(llist->dflts)) {
LY_ARRAY_FREE(llist->dflts_mods);
llist->dflts_mods = NULL;
LY_ARRAY_FREE(llist->dflts);
@@ -6671,7 +6671,7 @@
struct lyxp_set tmp_set;
struct lyxp_set_scnode *xp_scnode;
uint32_t i, j;
- LY_ARRAY_SIZE_TYPE u;
+ LY_ARRAY_COUNT_TYPE u;
int idx;
struct lysc_when *when;
LY_ERR ret = LY_SUCCESS;
@@ -6760,7 +6760,7 @@
{
struct lyxp_set tmp_set;
uint32_t i;
- LY_ARRAY_SIZE_TYPE u;
+ LY_ARRAY_COUNT_TYPE u;
int opts, input_done = 0;
struct lysc_when **when = NULL;
struct lysc_must *musts = NULL;
@@ -6899,7 +6899,7 @@
lys_resolve_prefix, lref->path_context, LYD_SCHEMA, &p));
/* get the target node */
- target = p[LY_ARRAY_SIZE(p) - 1].node;
+ target = p[LY_ARRAY_COUNT(p) - 1].node;
ly_path_free(node->module->ctx, p);
if (!(target->nodetype & (LYS_LEAF | LYS_LEAFLIST))) {
@@ -6994,7 +6994,7 @@
struct lysc_node *node;
struct lysc_type *type, *typeiter;
struct lysc_type_leafref *lref;
- LY_ARRAY_SIZE_TYPE v;
+ LY_ARRAY_COUNT_TYPE v;
uint32_t i;
/* for leafref, we need 2 rounds - first detects circular chain by storing the first referred type (which
@@ -7072,7 +7072,7 @@
struct lysp_augment **augments = NULL;
struct lysp_grp *grps;
struct lys_module *m;
- LY_ARRAY_SIZE_TYPE u, v;
+ LY_ARRAY_COUNT_TYPE u, v;
uint32_t i;
LY_ERR ret = LY_SUCCESS;