schema CHANGE convert 0-terminated arrays to sized-arrays
Introduce new "sized-arrays" - needed size is the same or smaller as for
0-terminated (terminated by zero pointer, so actually 4-8 bytes). But it
also directly provides number of items in the array.
diff --git a/src/common.h b/src/common.h
index 10631fc..d8ce013 100644
--- a/src/common.h
+++ b/src/common.h
@@ -262,17 +262,21 @@
LY_ERR lysp_check_date(struct ly_ctx *ctx, const char *date, int date_len, const char *stmt);
/*
- * Macros to work with 0-terminated arrays.
+ * Macros to work with sized-arrays.
*
- * There is a NULL pointer allocated after the last item to terminate the array.
+ * There is a 32b unsigned size (number of items) of the array at its beginning.
+ *
*/
-#define LYSP_ARRAY_NEW_RET(CTX, ARRAY, NEW_ITEM, RETVAL) int _count; \
- for (_count = 0; *(ARRAY) && *((void **)(*(ARRAY) + _count)); ++_count); \
- if (!_count) *(ARRAY) = malloc(sizeof **(ARRAY) + sizeof(void *)); \
- else *(ARRAY) = ly_realloc(*(ARRAY), (_count + 1) * sizeof **(ARRAY) + sizeof(void *)); \
- LY_CHECK_ERR_RET(!*(ARRAY), LOGMEM(CTX), RETVAL); \
- *((void **)(*(ARRAY) + _count + 1)) = NULL; \
- (NEW_ITEM) = (*(ARRAY)) + _count; \
+#define LYSP_ARRAY_NEW_RET(CTX, ARRAY, NEW_ITEM, RETVAL) \
+ if (!(ARRAY)) { \
+ ARRAY = malloc(sizeof(uint32_t) + sizeof *(ARRAY)); \
+ *((uint32_t*)(ARRAY)) = 1; \
+ } else { \
+ ++(*((uint32_t*)(ARRAY))); \
+ ARRAY = ly_realloc(ARRAY, sizeof(uint32_t) + (*((uint32_t*)(ARRAY)) * sizeof *(ARRAY))); \
+ LY_CHECK_ERR_RET(!(ARRAY), LOGMEM(CTX), RETVAL); \
+ } \
+ (NEW_ITEM) = (void*)((uint32_t*)((ARRAY) + *((uint32_t*)(ARRAY)) - 1) + 1); \
memset(NEW_ITEM, 0, sizeof *(NEW_ITEM));
#endif /* LY_COMMON_H_ */
diff --git a/src/libyang.h b/src/libyang.h
index eb0d3dd..bb93a74 100644
--- a/src/libyang.h
+++ b/src/libyang.h
@@ -22,6 +22,82 @@
#endif
/**
+ * @mainpage About
+ *
+ * libyang is a library implementing processing of the YANG schemas and data modeled by the YANG language. The
+ * library is implemented in C for GNU/Linux and provides C API.
+ *
+ * @section about-features Main Features
+ *
+ * - [Parsing (and validating) schemas](@ref howtoschemasparsers) in YANG format.
+ * - [Parsing (and validating) schemas](@ref howtoschemasparsers) in YIN format.
+ * - [Parsing, validating and printing instance data](@ref howtodata) in XML format.
+ * - [Parsing, validating and printing instance data](@ref howtodata) in JSON format
+ * ([RFC 7951](https://tools.ietf.org/html/rfc7951)).
+ * - [Manipulation with the instance data](@ref howtodatamanipulators).
+ * - Support for [default values in the instance data](@ref howtodatawd) ([RFC 6243](https://tools.ietf.org/html/rfc6243)).
+ * - Support for [YANG extensions and user types](@ref howtoschemaplugins).
+ * - Support for [YANG Metadata](@ref howtoschemametadata) ([RFC 7952](https://tools.ietf.org/html/rfc6243)).
+ *
+ * The current implementation covers YANG 1.0 ([RFC 6020](https://tools.ietf.org/html/rfc6020)) as well as
+ * YANG 1.1 ([RFC 7950](https://tools.ietf.org/html/rfc7950)).
+ *
+ * @section about-license License
+ *
+ * Copyright (c) 2015-2017 CESNET, z.s.p.o.
+ *
+ * (The BSD 3-Clause License)
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in
+ * the documentation and/or other materials provided with the
+ * distribution.
+ * 3. Neither the name of the Company nor the names of its contributors
+ * may be used to endorse or promote products derived from this
+ * software without specific prior written permission.
+ */
+
+/**
+ * @page howto How To ...
+ *
+ * - @subpage howtocontext
+ * - @subpage howtoschemas
+ * - @subpage howtodata
+ * - @subpage howtoxpath
+ * - @subpage howtoxml
+ * - @subpage howtothreads
+ * - @subpage howtologger
+ * - @subpage howtostructures
+ */
+
+/**
+ * @page howtostructures Data Structures
+ *
+ * @section sizedarrays Sized Arrays
+ *
+ * The structure starts with 32bit number storing size of the array - the number of the items inside. The size is part of the
+ * array to allocate it together with the array itself only when it is needed. This way the memory demands are decreased with
+ * possibility to have "infinite" (32bit) array of items. Because of a known size, it is not terminated by any special byte
+ * (sequence), so there is also no limit for specific content of the stored records (e.g. that first byte must not be NULL).
+ *
+ * Due to the structure, the records in the array cannot be accessed directly. There is a set of macros supposed to make
+ * work with the arrays more easy.
+ *
+ * - ::LY_ARRAY_SIZE
+ * - ::LY_ARRAY_INDEX
+ * - ::LY_ARRAY_FOR
+ *
+ * @section struct_lists Lists
+ *
+ * The lists are structures connected via a `next` pointer. Iterating over the siblings can be simply done by ::LY_LIST_FOR macro.
+ */
+
+/**
* @defgroup context Context
* @{
*
@@ -175,8 +251,8 @@
* @param[in] ctx libyang context to destroy
* @param[in] private_destructor Optional destructor function for private objects assigned
* to the nodes via lys_set_private(). If NULL, the private objects are not freed by libyang.
- * Remember the differences between the structures derived from ::lys_node and always check
- * ::lys_node#nodetype.
+ * Remember the differences between the structures derived from ::lysc_node and always check
+ * ::lysc_node#nodetype.
*/
void ly_ctx_destroy(struct ly_ctx *ctx, void (*private_destructor)(const struct lysc_node *node, void *priv));
diff --git a/src/parser_yang.c b/src/parser_yang.c
index 3643e56..8c907e5 100644
--- a/src/parser_yang.c
+++ b/src/parser_yang.c
@@ -1036,7 +1036,7 @@
struct lysp_ext_instance *e;
enum yang_keyword kw;
- LYSP_ARRAY_NEW_RET(ctx->ctx, exts, e, LY_EMEM);
+ LYSP_ARRAY_NEW_RET(ctx->ctx, *exts, e, LY_EMEM);
/* store name and insubstmt info */
e->name = lydict_insert(ctx->ctx, ext_name, ext_name_len);
@@ -1299,7 +1299,7 @@
enum yang_keyword kw;
struct lysp_include *inc;
- LYSP_ARRAY_NEW_RET(ctx->ctx, includes, inc, LY_EMEM);
+ LYSP_ARRAY_NEW_RET(ctx->ctx, *includes, inc, LY_EMEM);
/* get value */
ret = get_argument(ctx, data, Y_IDENTIF_ARG, &word, &buf, &word_len);
@@ -1351,7 +1351,7 @@
enum yang_keyword kw;
struct lysp_import *imp;
- LYSP_ARRAY_NEW_RET(ctx->ctx, &module->imports, imp, LY_EVALID);
+ LYSP_ARRAY_NEW_RET(ctx->ctx, module->imports, imp, LY_EVALID);
/* get value */
ret = get_argument(ctx, data, Y_IDENTIF_ARG, &word, &buf, &word_len);
@@ -1413,7 +1413,7 @@
enum yang_keyword kw;
struct lysp_revision *rev;
- LYSP_ARRAY_NEW_RET(ctx->ctx, revs, rev, LY_EMEM);
+ LYSP_ARRAY_NEW_RET(ctx->ctx, *revs, rev, LY_EMEM);
/* get value */
ret = get_argument(ctx, data, Y_STR_ARG, &word, &buf, &word_len);
@@ -1681,7 +1681,7 @@
{
struct lysp_restr *restr;
- LYSP_ARRAY_NEW_RET(ctx->ctx, restrs, restr, LY_EMEM);
+ LYSP_ARRAY_NEW_RET(ctx->ctx, *restrs, restr, LY_EMEM);
return parse_restr(ctx, data, restr_kw, restr);
}
@@ -1982,7 +1982,7 @@
enum yang_keyword kw;
struct lysp_type_enum *enm;
- LYSP_ARRAY_NEW_RET(ctx->ctx, enums, enm, LY_EMEM);
+ LYSP_ARRAY_NEW_RET(ctx->ctx, *enums, enm, LY_EMEM);
/* get value */
ret = get_argument(ctx, data, Y_STR_ARG, &word, &buf, &word_len);
@@ -2228,7 +2228,7 @@
enum yang_keyword kw;
struct lysp_restr *restr;
- LYSP_ARRAY_NEW_RET(ctx->ctx, patterns, restr, LY_EMEM);
+ LYSP_ARRAY_NEW_RET(ctx->ctx, *patterns, restr, LY_EMEM);
/* get value */
ret = get_argument(ctx, data, Y_STR_ARG, &word, &buf, &word_len);
@@ -2354,7 +2354,7 @@
break;
case YANG_TYPE:
{
- LYSP_ARRAY_NEW_RET(ctx->ctx, &type->types, nest_type, LY_EMEM);
+ LYSP_ARRAY_NEW_RET(ctx->ctx, type->types, nest_type, LY_EMEM);
}
ret = parse_type(ctx, data, nest_type);
break;
@@ -2787,7 +2787,7 @@
enum yang_keyword kw;
struct lysp_refine *rf;
- LYSP_ARRAY_NEW_RET(ctx->ctx, refines, rf, LY_EMEM);
+ LYSP_ARRAY_NEW_RET(ctx->ctx, *refines, rf, LY_EMEM);
/* get value */
ret = get_argument(ctx, data, Y_STR_ARG, &word, &buf, &word_len);
@@ -2860,7 +2860,7 @@
enum yang_keyword kw;
struct lysp_tpdf *tpdf;
- LYSP_ARRAY_NEW_RET(ctx->ctx, typedefs, tpdf, LY_EMEM);
+ LYSP_ARRAY_NEW_RET(ctx->ctx, *typedefs, tpdf, LY_EMEM);
/* get value */
ret = get_argument(ctx, data, Y_IDENTIF_ARG, &word, &buf, &word_len);
@@ -3007,7 +3007,7 @@
enum yang_keyword kw;
struct lysp_action *act;
- LYSP_ARRAY_NEW_RET(ctx->ctx, actions, act, LY_EMEM);
+ LYSP_ARRAY_NEW_RET(ctx->ctx, *actions, act, LY_EMEM);
/* get value */
ret = get_argument(ctx, data, Y_IDENTIF_ARG, &word, &buf, &word_len);
@@ -3076,7 +3076,7 @@
enum yang_keyword kw;
struct lysp_notif *notif;
- LYSP_ARRAY_NEW_RET(ctx->ctx, notifs, notif, LY_EMEM);
+ LYSP_ARRAY_NEW_RET(ctx->ctx, *notifs, notif, LY_EMEM);
/* get value */
ret = get_argument(ctx, data, Y_IDENTIF_ARG, &word, &buf, &word_len);
@@ -3164,7 +3164,7 @@
enum yang_keyword kw;
struct lysp_grp *grp;
- LYSP_ARRAY_NEW_RET(ctx->ctx, groupings, grp, LY_EMEM);
+ LYSP_ARRAY_NEW_RET(ctx->ctx, *groupings, grp, LY_EMEM);
/* get value */
ret = get_argument(ctx, data, Y_IDENTIF_ARG, &word, &buf, &word_len);
@@ -3253,7 +3253,7 @@
enum yang_keyword kw;
struct lysp_augment *aug;
- LYSP_ARRAY_NEW_RET(ctx->ctx, augments, aug, LY_EMEM);
+ LYSP_ARRAY_NEW_RET(ctx->ctx, *augments, aug, LY_EMEM);
/* get value */
ret = get_argument(ctx, data, Y_STR_ARG, &word, &buf, &word_len);
@@ -3974,7 +3974,7 @@
enum yang_keyword kw;
struct lysp_ext *ex;
- LYSP_ARRAY_NEW_RET(ctx->ctx, extensions, ex, LY_EMEM);
+ LYSP_ARRAY_NEW_RET(ctx->ctx, *extensions, ex, LY_EMEM);
/* get value */
ret = get_argument(ctx, data, Y_IDENTIF_ARG, &word, &buf, &word_len);
@@ -4249,7 +4249,7 @@
enum yang_keyword kw;
struct lysp_deviation *dev;
- LYSP_ARRAY_NEW_RET(ctx->ctx, deviations, dev, LY_EMEM);
+ LYSP_ARRAY_NEW_RET(ctx->ctx, *deviations, dev, LY_EMEM);
/* get value */
ret = get_argument(ctx, data, Y_STR_ARG, &word, &buf, &word_len);
@@ -4307,7 +4307,7 @@
enum yang_keyword kw;
struct lysp_feature *feat;
- LYSP_ARRAY_NEW_RET(ctx->ctx, features, feat, LY_EMEM);
+ LYSP_ARRAY_NEW_RET(ctx->ctx, *features, feat, LY_EMEM);
/* get value */
ret = get_argument(ctx, data, Y_IDENTIF_ARG, &word, &buf, &word_len);
@@ -4362,7 +4362,7 @@
enum yang_keyword kw;
struct lysp_ident *ident;
- LYSP_ARRAY_NEW_RET(ctx->ctx, identities, ident, LY_EMEM);
+ LYSP_ARRAY_NEW_RET(ctx->ctx, *identities, ident, LY_EMEM);
/* get value */
ret = get_argument(ctx, data, Y_IDENTIF_ARG, &word, &buf, &word_len);
diff --git a/src/set.h b/src/set.h
index 5834b8c..f16feae 100644
--- a/src/set.h
+++ b/src/set.h
@@ -28,8 +28,8 @@
*/
/**
- * @brief Structure to hold a set of (not necessary somehow connected) objects. Usually used for ::lyd_node
- * or ::lys_node objects, but it is not limited to them. Caller is supposed to not mix the type of objects
+ * @brief Structure to hold a set of (not necessary somehow connected) objects. Usually used for ::lyd_node,
+ * ::lysp_node or ::lysc_node objects, but it is not limited to them. Caller is supposed to not mix the type of objects
* added to the set and according to its knowledge about the set content, it can access objects via the members
* of the set union.
*
@@ -43,12 +43,7 @@
{
unsigned int size; /**< allocated size of the set array */
unsigned int count; /**< number of elements in (used size of) the set array */
- union
- {
- struct lys_node **schemas; /**< array of pointers to a ::lys_node objects */
- struct lyd_node **data; /**< array of pointers to a ::lyd_node objects */
- void **objs; /**< dummy array for generic work */
- }; /**< set array - union to simplify access to the stored objects */
+ void **objs; /**< set array of generic object pointers */
};
/**
@@ -76,7 +71,7 @@
struct ly_set *ly_set_dup(const struct ly_set *set, void *(*duplicator)(void *obj));
/**
- * @brief Add a ::lyd_node or ::lys_node object into the set
+ * @brief Add an object into the set
*
* Since it is a set, the function checks for duplicity and if the
* node is already in the set, the index of the previously added
@@ -129,7 +124,7 @@
* (the last object is placed instead of the removed object).
*
* @param[in] set Set from which the \p node will be removed.
- * @param[in] obejct The object to be removed from the \p set.
+ * @param[in] object The object to be removed from the \p set.
* @param[in] destructor Optional function to free the objects being removed.
* @return LY_ERR return value.
*/
diff --git a/src/tree_schema.c b/src/tree_schema.c
index 01c169b..955f8ab 100644
--- a/src/tree_schema.c
+++ b/src/tree_schema.c
@@ -16,7 +16,7 @@
#include "common.h"
#include "tree_schema_internal.h"
-#define FREE_ARRAY(CTX, ARRAY, ITER, FUNC) LY_ARRAY_FOR(ARRAY, ITER){FUNC(CTX, &ARRAY[ITER], dict);}free(ARRAY);
+#define FREE_ARRAY(CTX, ARRAY, FUNC) {uint64_t c__; LY_ARRAY_FOR(ARRAY, c__){FUNC(CTX, LY_ARRAY_INDEX(ARRAY, c__), dict);}free(ARRAY);}
#define FREE_MEMBER(CTX, MEMBER, FUNC) if (MEMBER) {FUNC(CTX, MEMBER, dict);free(MEMBER);}
#define FREE_STRING(CTX, STRING) if (dict && STRING) {lydict_remove(CTX, STRING);}
@@ -54,43 +54,48 @@
static void
lysp_import_free(struct ly_ctx *ctx, struct lysp_import *import, int dict)
{
- unsigned int u;
-
FREE_STRING(ctx, import->name);
FREE_STRING(ctx, import->prefix);
FREE_STRING(ctx, import->dsc);
FREE_STRING(ctx, import->ref);
- FREE_ARRAY(ctx, import->exts, u, lysp_ext_instance_free);
+ FREE_ARRAY(ctx, import->exts, lysp_ext_instance_free);
+ {
+ void *p__;
+ int64_t c__;
+ for(p__ = ((void*)((uint32_t*)((import->exts) + 0) + 1)), c__ = 0;
+ (import->exts) && c__ < (*(uint32_t*)(import->exts));
+ p__ = ((void*)((uint32_t*)((import->exts) + c__) + 1))) {
+ lysp_ext_instance_free(ctx, p__, dict);
+ }
+ free(import->exts);
+ }
}
static void
lysp_include_free(struct ly_ctx *ctx, struct lysp_include *include, int dict)
{
- unsigned int u;
FREE_STRING(ctx, include->name);
FREE_STRING(ctx, include->dsc);
FREE_STRING(ctx, include->ref);
- FREE_ARRAY(ctx, include->exts, u, lysp_ext_instance_free);
+ FREE_ARRAY(ctx, include->exts, lysp_ext_instance_free);
}
static void
lysp_revision_free(struct ly_ctx *ctx, struct lysp_revision *rev, int dict)
{
- unsigned int u;
FREE_STRING(ctx, rev->dsc);
FREE_STRING(ctx, rev->ref);
- FREE_ARRAY(ctx, rev->exts, u, lysp_ext_instance_free);
+ FREE_ARRAY(ctx, rev->exts, lysp_ext_instance_free);
}
static void
lysp_ext_free(struct ly_ctx *ctx, struct lysp_ext *ext, int dict)
{
- unsigned int u;
FREE_STRING(ctx, ext->name);
FREE_STRING(ctx, ext->argument);
FREE_STRING(ctx, ext->dsc);
FREE_STRING(ctx, ext->ref);
- FREE_ARRAY(ctx, ext->exts, u, lysp_ext_instance_free);
+ FREE_ARRAY(ctx, ext->exts, lysp_ext_instance_free);
}
static void
@@ -104,7 +109,7 @@
free(feat->iffeatures);
FREE_STRING(ctx, feat->dsc);
FREE_STRING(ctx, feat->ref);
- FREE_ARRAY(ctx, feat->exts, u, lysp_ext_instance_free);
+ FREE_ARRAY(ctx, feat->exts, lysp_ext_instance_free);
}
static void
@@ -122,19 +127,18 @@
free(ident->bases);
FREE_STRING(ctx, ident->dsc);
FREE_STRING(ctx, ident->ref);
- FREE_ARRAY(ctx, ident->exts, u, lysp_ext_instance_free);
+ FREE_ARRAY(ctx, ident->exts, lysp_ext_instance_free);
}
static void
lysp_restr_free(struct ly_ctx *ctx, struct lysp_restr *restr, int dict)
{
- unsigned int u;
FREE_STRING(ctx, restr->arg);
FREE_STRING(ctx, restr->emsg);
FREE_STRING(ctx, restr->eapptag);
FREE_STRING(ctx, restr->dsc);
FREE_STRING(ctx, restr->ref);
- FREE_ARRAY(ctx, restr->exts, u, lysp_ext_instance_free);
+ FREE_ARRAY(ctx, restr->exts, lysp_ext_instance_free);
}
static void
@@ -148,7 +152,7 @@
FREE_STRING(ctx, item->iffeatures[u]);
}
free(item->iffeatures);
- FREE_ARRAY(ctx, item->exts, u, lysp_ext_instance_free);
+ FREE_ARRAY(ctx, item->exts, lysp_ext_instance_free);
}
static void
@@ -158,44 +162,42 @@
FREE_STRING(ctx, type->name);
FREE_MEMBER(ctx, type->range, lysp_restr_free);
FREE_MEMBER(ctx, type->length, lysp_restr_free);
- FREE_ARRAY(ctx, type->patterns, u, lysp_restr_free);
- FREE_ARRAY(ctx, type->enums, u, lysp_type_enum_free);
- FREE_ARRAY(ctx, type->bits, u, lysp_type_enum_free);
+ FREE_ARRAY(ctx, type->patterns, lysp_restr_free);
+ FREE_ARRAY(ctx, type->enums, lysp_type_enum_free);
+ FREE_ARRAY(ctx, type->bits, lysp_type_enum_free);
FREE_STRING(ctx, type->path);
for (u = 0; type->bases && type->bases[u]; ++u) {
FREE_STRING(ctx, type->bases[u]);
}
free(type->bases);
- FREE_ARRAY(ctx, type->types, u, lysp_type_free);
- FREE_ARRAY(ctx, type->exts, u, lysp_ext_instance_free);
+ FREE_ARRAY(ctx, type->types, lysp_type_free);
+ FREE_ARRAY(ctx, type->exts, lysp_ext_instance_free);
}
static void
lysp_tpdf_free(struct ly_ctx *ctx, struct lysp_tpdf *tpdf, int dict)
{
- unsigned int u;
FREE_STRING(ctx, tpdf->name);
FREE_STRING(ctx, tpdf->units);
FREE_STRING(ctx, tpdf->dflt);
FREE_STRING(ctx, tpdf->dsc);
FREE_STRING(ctx, tpdf->ref);
- FREE_ARRAY(ctx, tpdf->exts, u, lysp_ext_instance_free);
+ FREE_ARRAY(ctx, tpdf->exts, lysp_ext_instance_free);
lysp_type_free(ctx, &tpdf->type, dict);
}
static void
lysp_action_inout_free(struct ly_ctx *ctx, struct lysp_action_inout *inout, int dict)
{
- unsigned int u;
struct lysp_node *node, *next;
- FREE_ARRAY(ctx, inout->musts, u, lysp_restr_free);
- FREE_ARRAY(ctx, inout->typedefs, u, lysp_tpdf_free);
- FREE_ARRAY(ctx, inout->groupings, u, lysp_grp_free);
+ FREE_ARRAY(ctx, inout->musts, lysp_restr_free);
+ FREE_ARRAY(ctx, inout->typedefs, lysp_tpdf_free);
+ FREE_ARRAY(ctx, inout->groupings, lysp_grp_free);
LY_LIST_FOR_SAFE(inout->data, next, node) {
lysp_node_free(ctx, node, dict);
}
- FREE_ARRAY(ctx, inout->exts, u, lysp_ext_instance_free);
+ FREE_ARRAY(ctx, inout->exts, lysp_ext_instance_free);
}
@@ -210,11 +212,11 @@
FREE_STRING(ctx, action->iffeatures[u]);
}
free(action->iffeatures);
- FREE_ARRAY(ctx, action->typedefs, u, lysp_tpdf_free);
- FREE_ARRAY(ctx, action->groupings, u, lysp_grp_free);
+ FREE_ARRAY(ctx, action->typedefs, lysp_tpdf_free);
+ FREE_ARRAY(ctx, action->groupings, lysp_grp_free);
FREE_MEMBER(ctx, action->input, lysp_action_inout_free);
FREE_MEMBER(ctx, action->output, lysp_action_inout_free);
- FREE_ARRAY(ctx, action->exts, u, lysp_ext_instance_free);
+ FREE_ARRAY(ctx, action->exts, lysp_ext_instance_free);
}
static void
@@ -230,42 +232,40 @@
FREE_STRING(ctx, notif->iffeatures[u]);
}
free(notif->iffeatures);
- FREE_ARRAY(ctx, notif->musts, u, lysp_restr_free);
- FREE_ARRAY(ctx, notif->typedefs, u, lysp_tpdf_free);
- FREE_ARRAY(ctx, notif->groupings, u, lysp_grp_free);
+ FREE_ARRAY(ctx, notif->musts, lysp_restr_free);
+ FREE_ARRAY(ctx, notif->typedefs, lysp_tpdf_free);
+ FREE_ARRAY(ctx, notif->groupings, lysp_grp_free);
LY_LIST_FOR_SAFE(notif->data, next, node) {
lysp_node_free(ctx, node, dict);
}
- FREE_ARRAY(ctx, notif->exts, u, lysp_ext_instance_free);
+ FREE_ARRAY(ctx, notif->exts, lysp_ext_instance_free);
}
static void
lysp_grp_free(struct ly_ctx *ctx, struct lysp_grp *grp, int dict)
{
- unsigned int u;
struct lysp_node *node, *next;
FREE_STRING(ctx, grp->name);
FREE_STRING(ctx, grp->dsc);
FREE_STRING(ctx, grp->ref);
- FREE_ARRAY(ctx, grp->typedefs, u, lysp_tpdf_free);
- FREE_ARRAY(ctx, grp->groupings, u, lysp_grp_free);
+ FREE_ARRAY(ctx, grp->typedefs, lysp_tpdf_free);
+ FREE_ARRAY(ctx, grp->groupings, lysp_grp_free);
LY_LIST_FOR_SAFE(grp->data, next, node) {
lysp_node_free(ctx, node, dict);
}
- FREE_ARRAY(ctx, grp->actions, u, lysp_action_free);
- FREE_ARRAY(ctx, grp->notifs, u, lysp_notif_free);
- FREE_ARRAY(ctx, grp->exts, u, lysp_ext_instance_free);
+ FREE_ARRAY(ctx, grp->actions, lysp_action_free);
+ FREE_ARRAY(ctx, grp->notifs, lysp_notif_free);
+ FREE_ARRAY(ctx, grp->exts, lysp_ext_instance_free);
}
static void
lysp_when_free(struct ly_ctx *ctx, struct lysp_when *when, int dict)
{
- unsigned int u;
FREE_STRING(ctx, when->cond);
FREE_STRING(ctx, when->dsc);
FREE_STRING(ctx, when->ref);
- FREE_ARRAY(ctx, when->exts, u, lysp_ext_instance_free);
+ FREE_ARRAY(ctx, when->exts, lysp_ext_instance_free);
}
static void
@@ -285,9 +285,9 @@
LY_LIST_FOR_SAFE(augment->child, next, node) {
lysp_node_free(ctx, node, dict);
}
- FREE_ARRAY(ctx, augment->actions, u, lysp_action_free);
- FREE_ARRAY(ctx, augment->notifs, u, lysp_notif_free);
- FREE_ARRAY(ctx, augment->exts, u, lysp_ext_instance_free);
+ FREE_ARRAY(ctx, augment->actions, lysp_action_free);
+ FREE_ARRAY(ctx, augment->notifs, lysp_notif_free);
+ FREE_ARRAY(ctx, augment->exts, lysp_ext_instance_free);
}
static void
@@ -297,7 +297,7 @@
struct lysp_deviate_add *add = (struct lysp_deviate_add*)d;
struct lysp_deviate_rpl *rpl = (struct lysp_deviate_rpl*)d;
- FREE_ARRAY(ctx, d->exts, u, lysp_ext_instance_free);
+ FREE_ARRAY(ctx, d->exts, lysp_ext_instance_free);
switch(d->mod) {
case LYS_DEV_NOT_SUPPORTED:
/* nothing to do */
@@ -305,7 +305,7 @@
case LYS_DEV_ADD:
case LYS_DEV_DELETE: /* compatible for dynamically allocated data */
FREE_STRING(ctx, add->units);
- FREE_ARRAY(ctx, add->musts, u, lysp_restr_free);
+ FREE_ARRAY(ctx, add->musts, lysp_restr_free);
for (u = 0; add->uniques && add->uniques[u]; ++u) {
FREE_STRING(ctx, add->uniques[u]);
}
@@ -329,7 +329,6 @@
static void
lysp_deviation_free(struct ly_ctx *ctx, struct lysp_deviation *dev, int dict)
{
- unsigned int u;
struct lysp_deviate *next, *iter;
FREE_STRING(ctx, dev->nodeid);
@@ -339,7 +338,7 @@
lysp_deviate_free(ctx, iter, dict);
free(iter);
}
- FREE_ARRAY(ctx, dev->exts, u, lysp_ext_instance_free);
+ FREE_ARRAY(ctx, dev->exts, lysp_ext_instance_free);
}
static void
@@ -353,13 +352,13 @@
FREE_STRING(ctx, ref->iffeatures[u]);
}
free(ref->iffeatures);
- FREE_ARRAY(ctx, ref->musts, u, lysp_restr_free);
+ FREE_ARRAY(ctx, ref->musts, lysp_restr_free);
FREE_STRING(ctx, ref->presence);
for (u = 0; ref->dflts && ref->dflts[u]; ++u) {
FREE_STRING(ctx, ref->dflts[u]);
}
free(ref->dflts);
- FREE_ARRAY(ctx, ref->exts, u, lysp_ext_instance_free);
+ FREE_ARRAY(ctx, ref->exts, lysp_ext_instance_free);
}
static void
@@ -376,28 +375,28 @@
FREE_STRING(ctx, node->iffeatures[u]);
}
free(node->iffeatures);
- FREE_ARRAY(ctx, node->exts, u, lysp_ext_instance_free);
+ FREE_ARRAY(ctx, node->exts, lysp_ext_instance_free);
switch(node->nodetype) {
case LYS_CONTAINER:
- FREE_ARRAY(ctx, ((struct lysp_node_container*)node)->musts, u, lysp_restr_free);
+ FREE_ARRAY(ctx, ((struct lysp_node_container*)node)->musts, lysp_restr_free);
FREE_STRING(ctx, ((struct lysp_node_container*)node)->presence);
- FREE_ARRAY(ctx, ((struct lysp_node_container*)node)->typedefs, u, lysp_tpdf_free);
- FREE_ARRAY(ctx, ((struct lysp_node_container*)node)->groupings, u, lysp_grp_free);
+ FREE_ARRAY(ctx, ((struct lysp_node_container*)node)->typedefs, lysp_tpdf_free);
+ FREE_ARRAY(ctx, ((struct lysp_node_container*)node)->groupings, lysp_grp_free);
LY_LIST_FOR_SAFE(((struct lysp_node_container*)node)->child, next, child) {
lysp_node_free(ctx, child, dict);
}
- FREE_ARRAY(ctx, ((struct lysp_node_container*)node)->actions, u, lysp_action_free);
- FREE_ARRAY(ctx, ((struct lysp_node_container*)node)->notifs, u, lysp_notif_free);
+ FREE_ARRAY(ctx, ((struct lysp_node_container*)node)->actions, lysp_action_free);
+ FREE_ARRAY(ctx, ((struct lysp_node_container*)node)->notifs, lysp_notif_free);
break;
case LYS_LEAF:
- FREE_ARRAY(ctx, ((struct lysp_node_leaf*)node)->musts, u, lysp_restr_free);
+ FREE_ARRAY(ctx, ((struct lysp_node_leaf*)node)->musts, lysp_restr_free);
lysp_type_free(ctx, &((struct lysp_node_leaf*)node)->type, dict);
FREE_STRING(ctx, ((struct lysp_node_leaf*)node)->units);
FREE_STRING(ctx, ((struct lysp_node_leaf*)node)->dflt);
break;
case LYS_LEAFLIST:
- FREE_ARRAY(ctx, ((struct lysp_node_leaflist*)node)->musts, u, lysp_restr_free);
+ FREE_ARRAY(ctx, ((struct lysp_node_leaflist*)node)->musts, lysp_restr_free);
lysp_type_free(ctx, &((struct lysp_node_leaflist*)node)->type, dict);
FREE_STRING(ctx, ((struct lysp_node_leaflist*)node)->units);
for (u = 0; ((struct lysp_node_leaflist*)node)->dflts && ((struct lysp_node_leaflist*)node)->dflts[u]; ++u) {
@@ -406,15 +405,15 @@
free(((struct lysp_node_leaflist*)node)->dflts);
break;
case LYS_LIST:
- FREE_ARRAY(ctx, ((struct lysp_node_list*)node)->musts, u, lysp_restr_free);
+ FREE_ARRAY(ctx, ((struct lysp_node_list*)node)->musts, lysp_restr_free);
FREE_STRING(ctx, ((struct lysp_node_list*)node)->key);
- FREE_ARRAY(ctx, ((struct lysp_node_list*)node)->typedefs, u, lysp_tpdf_free);
- FREE_ARRAY(ctx, ((struct lysp_node_list*)node)->groupings, u, lysp_grp_free);
+ FREE_ARRAY(ctx, ((struct lysp_node_list*)node)->typedefs, lysp_tpdf_free);
+ FREE_ARRAY(ctx, ((struct lysp_node_list*)node)->groupings, lysp_grp_free);
LY_LIST_FOR_SAFE(((struct lysp_node_list*)node)->child, next, child) {
lysp_node_free(ctx, child, dict);
}
- FREE_ARRAY(ctx, ((struct lysp_node_list*)node)->actions, u, lysp_action_free);
- FREE_ARRAY(ctx, ((struct lysp_node_list*)node)->notifs, u, lysp_notif_free);
+ FREE_ARRAY(ctx, ((struct lysp_node_list*)node)->actions, lysp_action_free);
+ FREE_ARRAY(ctx, ((struct lysp_node_list*)node)->notifs, lysp_notif_free);
for (u = 0; ((struct lysp_node_list*)node)->uniques && ((struct lysp_node_list*)node)->uniques[u]; ++u) {
FREE_STRING(ctx, ((struct lysp_node_list*)node)->uniques[u]);
}
@@ -433,11 +432,11 @@
break;
case LYS_ANYDATA:
case LYS_ANYXML:
- FREE_ARRAY(ctx, ((struct lysp_node_anydata*)node)->musts, u, lysp_restr_free);
+ FREE_ARRAY(ctx, ((struct lysp_node_anydata*)node)->musts, lysp_restr_free);
break;
case LYS_USES:
- FREE_ARRAY(ctx, ((struct lysp_node_uses*)node)->refines, u, lysp_refine_free);
- FREE_ARRAY(ctx, ((struct lysp_node_uses*)node)->augments, u, lysp_augment_free);
+ FREE_ARRAY(ctx, ((struct lysp_node_uses*)node)->refines, lysp_refine_free);
+ FREE_ARRAY(ctx, ((struct lysp_node_uses*)node)->augments, lysp_augment_free);
break;
default:
LOGINT(ctx);
@@ -450,7 +449,6 @@
lysp_module_free_(struct lysp_module *module, int dict)
{
struct ly_ctx *ctx;
- unsigned int u;
struct lysp_node *node, *next;
LY_CHECK_ARG_RET(NULL, module,);
@@ -461,28 +459,28 @@
FREE_STRING(ctx, module->ns); /* or belongs-to */
FREE_STRING(ctx, module->prefix);
- FREE_ARRAY(ctx, module->imports, u, lysp_import_free);
- FREE_ARRAY(ctx, module->includes, u, lysp_include_free);
+ FREE_ARRAY(ctx, module->imports, lysp_import_free);
+ FREE_ARRAY(ctx, module->includes, lysp_include_free);
FREE_STRING(ctx, module->org);
FREE_STRING(ctx, module->contact);
FREE_STRING(ctx, module->dsc);
FREE_STRING(ctx, module->ref);
- FREE_ARRAY(ctx, module->revs, u, lysp_revision_free);
- FREE_ARRAY(ctx, module->extensions, u, lysp_ext_free);
- FREE_ARRAY(ctx, module->features, u, lysp_feature_free);
- FREE_ARRAY(ctx, module->identities, u, lysp_ident_free);
- FREE_ARRAY(ctx, module->typedefs, u, lysp_tpdf_free);
- FREE_ARRAY(ctx, module->groupings, u, lysp_grp_free);
+ FREE_ARRAY(ctx, module->revs, lysp_revision_free);
+ FREE_ARRAY(ctx, module->extensions, lysp_ext_free);
+ FREE_ARRAY(ctx, module->features, lysp_feature_free);
+ FREE_ARRAY(ctx, module->identities, lysp_ident_free);
+ FREE_ARRAY(ctx, module->typedefs, lysp_tpdf_free);
+ FREE_ARRAY(ctx, module->groupings, lysp_grp_free);
LY_LIST_FOR_SAFE(module->data, next, node) {
lysp_node_free(ctx, node, dict);
}
- FREE_ARRAY(ctx, module->augments, u, lysp_augment_free);
- FREE_ARRAY(ctx, module->rpcs, u, lysp_action_free);
- FREE_ARRAY(ctx, module->notifs, u, lysp_notif_free);
- FREE_ARRAY(ctx, module->deviations, u, lysp_deviation_free);
- FREE_ARRAY(ctx, module->exts, u, lysp_ext_instance_free);
+ FREE_ARRAY(ctx, module->augments, lysp_augment_free);
+ FREE_ARRAY(ctx, module->rpcs, lysp_action_free);
+ FREE_ARRAY(ctx, module->notifs, lysp_notif_free);
+ FREE_ARRAY(ctx, module->deviations, lysp_deviation_free);
+ FREE_ARRAY(ctx, module->exts, lysp_ext_instance_free);
free(module);
}
@@ -504,7 +502,6 @@
lysc_module_free_(struct lysc_module *module, int dict)
{
struct ly_ctx *ctx;
- unsigned int u;
LY_CHECK_ARG_RET(NULL, module,);
ctx = module->ctx;
@@ -514,7 +511,7 @@
FREE_STRING(ctx, module->prefix);
- FREE_ARRAY(ctx, module->features, u, lysc_feature_free);
+ FREE_ARRAY(ctx, module->features, lysc_feature_free);
free(module);
@@ -529,7 +526,7 @@
LY_ERR
lysp_check_prefix(struct ly_parser_ctx *ctx, struct lysp_module *module, const char **value)
{
- unsigned int u;
+ struct lysp_import *i;
if (module->prefix && &module->prefix != value && !strcmp(module->prefix, *value)) {
LOGVAL(ctx->ctx, LY_VLOG_LINE, &ctx->line, LYVE_REFERENCE,
@@ -537,10 +534,10 @@
return LY_EEXIST;
}
if (module->imports) {
- LY_ARRAY_FOR(module->imports, u) {
- if (module->imports[u].prefix && &module->imports[u].prefix != value && !strcmp(module->imports[u].prefix, *value)) {
+ LY_ARRAY_FOR(module->imports, struct lysp_import, i) {
+ if (i->prefix && &i->prefix != value && !strcmp(i->prefix, *value)) {
LOGVAL(ctx->ctx, LY_VLOG_LINE, &ctx->line, LYVE_REFERENCE,
- "Prefix \"%s\" already used to import \"%s\" module.", *value, module->imports[u].name);
+ "Prefix \"%s\" already used to import \"%s\" module.", *value, i->name);
return LY_EEXIST;
}
}
@@ -553,7 +550,7 @@
{
struct lysc_feature *feature;
- LYSP_ARRAY_NEW_RET(ctx, features, feature, LY_EMEM);
+ LYSP_ARRAY_NEW_RET(ctx, *features, feature, LY_EMEM);
if (options & LYSC_OPT_FREE_SP) {
/* just switch the pointers */
@@ -573,9 +570,9 @@
/* shortcuts */
struct ly_ctx *ctx;
struct lysc_module *mod_c;
+ void *p;
LY_ERR ret;
- unsigned int u;
LY_CHECK_ARG_RET(NULL, sc, sp, sp->ctx, LY_EINVAL);
ctx = sp->ctx;
@@ -602,8 +599,8 @@
}
if (sp->features) {
- LY_ARRAY_FOR(sp->features, u) {
- ret = lys_compile_feature(ctx, &sp->features[u], options, &mod_c->features);
+ LY_ARRAY_FOR(sp->features, struct lysp_feature, p) {
+ ret = lys_compile_feature(ctx, p, options, &mod_c->features);
LY_CHECK_GOTO(ret != LY_SUCCESS, error);
}
}
diff --git a/src/tree_schema.h b/src/tree_schema.h
index 6f3c82c..e503d52 100644
--- a/src/tree_schema.h
+++ b/src/tree_schema.h
@@ -27,6 +27,50 @@
struct lyxp_expr;
/**
+ * @brief Macro selector for other LY_ARRAY_* macros, do not use directly!
+ */
+#define LY_ARRAY_SELECT(_1, _2, NAME, ...) NAME
+
+/**
+ * @brief Get void pointer to the item on the INDEX in the ARRAY
+ */
+#define LY_ARRAY_INDEX1(ARRAY, INDEX) ((void*)((uint32_t*)((ARRAY) + INDEX) + 1))
+
+/**
+ * @brief Get the TYPE pointer to the item on the INDEX in the ARRAY
+ */
+#define LY_ARRAY_INDEX2(ARRAY, INDEX, TYPE) ((TYPE*)((uint32_t*)((ARRAY) + INDEX) + 1))
+
+/**
+ * @brief Helper macro to go through sized-arrays with a pointer iterator.
+ *
+ * Use with opening curly bracket (`{`).
+ *
+ * @param[in] ARRAY Array to go through
+ * @param[in] TYPE Type of the records in the ARRAY
+ * @param[out] ITER Iterating pointer to the item being processed in each loop
+ */
+#define LY_ARRAY_FOR_ITER(ARRAY, TYPE, ITER) \
+ for (ITER = LY_ARRAY_INDEX1(ARRAY, 0); \
+ (ARRAY) && ((void*)ITER - (void*)ARRAY - sizeof(uint32_t))/(sizeof(TYPE)) < (*(uint32_t*)(ARRAY)); \
+ ITER = (void*)((TYPE*)ITER + 1))
+
+/**
+ * @brief Helper macro to go through sized-arrays with a numeric iterator.
+ *
+ * Use with opening curly bracket (`{`).
+ *
+ * To access an item with the INDEX value, use always LY_ARRAY_INDEX macro!
+ *
+ * @param[in] ARRAY Array to go through
+ * @param[out] INDEX Iterating index of the item being processed in each loop
+ */
+#define LY_ARRAY_FOR_INDEX(ARRAY, INDEX) \
+ for (INDEX = 0; \
+ ARRAY && INDEX < (*((uint32_t*)(ARRAY))); \
+ ++INDEX)
+
+/**
* @defgroup schematree Schema Tree
* @{
*
@@ -34,14 +78,36 @@
*/
/**
- * @brief Helper macro to go through 0-terminated arrays
+ * @brief Get (optionally TYPEd) pointer to the item on the INDEX in the ARRAY
*
- * Use with opening curly bracket '{'.
- *
- * @param[in] ARRAY Array to go through
- * @param[out] ITER Numeric iterator storing available indexes of the ARRAY
+ * LY_ARRAY_INDEX(ARRAY, INDEX [, TYPE])
*/
-#define LY_ARRAY_FOR(ARRAY, ITER) for (ITER = 0; (ARRAY) && *((void **)((ARRAY) + ITER)); ++ITER)
+#define LY_ARRAY_INDEX(ARRAY, ...) LY_ARRAY_SELECT(__VA_ARGS__, LY_ARRAY_INDEX2, LY_ARRAY_INDEX1)(ARRAY, __VA_ARGS__)
+
+/**
+ * @brief Get a number of records in the ARRAY.
+ */
+#define LY_ARRAY_SIZE(ARRAY) (*((uint32_t*)(ARRAY)))
+
+/**
+ * @brief Sized-array iterator (for-loop).
+ *
+ * Use with opening curly bracket (`{`).
+ *
+ * There are 2 variants:
+ *
+ * LY_ARRAY_FOR(ARRAY, TYPE, ITER)
+ *
+ * Where ARRAY is a sized-array to go through, TYPE is the type of the items in the ARRAY and ITER is a pointer variable
+ * providing the items of the ARRAY in the loops. This functionality is provided by LY_ARRAY_FOR_ITER macro
+ *
+ * LY_ARRAY_FOR(ARRAY, INDEX)
+ *
+ * The ARRAY is again a sized-array to go through, the INDEX is a variable (unsigned integer) for storing iterating ARRAY's index
+ * to access the items of ARRAY in the loops. The INDEX is supposed to be used via LY_ARRAY_INDEX macro which can provide the item
+ * in the loop body. This functionality is provided by LY_ARRAY_FOR_INDEX macro.
+ */
+#define LY_ARRAY_FOR(ARRAY, ...) LY_ARRAY_SELECT(__VA_ARGS__, LY_ARRAY_FOR_ITER, LY_ARRAY_FOR_INDEX)(ARRAY, __VA_ARGS__)
/**
* @brief Macro to iterate via all sibling elements without affecting the list itself
@@ -49,7 +115,7 @@
* Works for all types of nodes despite it is data or schema tree, but all the
* parameters must be pointers to the same type.
*
- * Use with opening curly bracket '{'. All parameters must be of the same type.
+ * Use with opening curly bracket (`{`). All parameters must be of the same type.
*
* @param START Pointer to the starting element.
* @param ELEM Iterator.
@@ -63,7 +129,7 @@
* @ingroup datatree
* @brief Macro to iterate via all sibling elements allowing to modify the list itself (e.g. removing elements)
*
- * Use with opening curly bracket '{'. All parameters must be of the same type.
+ * Use with opening curly bracket (`{`). All parameters must be of the same type.
*
* @param START Pointer to the starting element.
* @param NEXT Temporary storage to allow removing of the current iterator content.
@@ -116,7 +182,7 @@
const char *prefix; /**< prefix for the data from the imported schema (mandatory) */
const char *dsc; /**< description */
const char *ref; /**< reference */
- struct lysp_ext_instance *exts; /**< list of the extension instances (0-terminated) */
+ struct lysp_ext_instance *exts; /**< list of the extension instances ([sized array](@ref sizedarrays)) */
char rev[LY_REV_SIZE]; /**< revision-date of the imported module */
};
@@ -127,7 +193,7 @@
const char *name; /**< name of the submodule to include (mandatory) */
const char *dsc; /**< description */
const char *ref; /**< reference */
- struct lysp_ext_instance *exts; /**< list of the extension instances (0-terminated) */
+ struct lysp_ext_instance *exts; /**< list of the extension instances ([sized array](@ref sizedarrays)) */
char rev[LY_REV_SIZE]; /**< revision-date of the included submodule */
};
@@ -139,7 +205,7 @@
const char *argument; /**< argument name, NULL if not specified */
const char *dsc; /**< description statement */
const char *ref; /**< reference statement */
- struct lysp_ext_instance *exts; /**< list of the extension instances (0-terminated) */
+ struct lysp_ext_instance *exts; /**< list of the extension instances ([sized array](@ref sizedarrays)) */
uint16_t flags; /**< LYS_STATUS_* and LYS_YINELEM values (@ref snodeflags) */
};
@@ -223,7 +289,7 @@
const char **iffeatures; /**< list of if-feature expressions (NULL-terminated) */
const char *dsc; /**< description statement */
const char *ref; /**< reference statement */
- struct lysp_ext_instance *exts; /**< list of the extension instances (0-terminated) */
+ struct lysp_ext_instance *exts; /**< list of the extension instances ([sized array](@ref sizedarrays)) */
uint16_t flags; /**< [schema node flags](@ref snodeflags) - only LYS_STATUS_* values allowed */
};
@@ -236,7 +302,7 @@
const char **bases; /**< list of base identifiers (NULL-terminated) */
const char *dsc; /**< description statement */
const char *ref; /**< reference statement */
- struct lysp_ext_instance *exts; /**< list of the extension instances (0-terminated) */
+ struct lysp_ext_instance *exts; /**< list of the extension instances ([sized array](@ref sizedarrays)) */
uint16_t flags; /**< [schema node flags](@ref snodeflags) - only LYS_STATUS_ values are allowed */
};
@@ -251,7 +317,7 @@
const char *eapptag; /**< error-app-tag value */
const char *dsc; /**< description */
const char *ref; /**< reference */
- struct lysp_ext_instance *exts; /**< list of the extension instances (0-terminated) */
+ struct lysp_ext_instance *exts; /**< list of the extension instances ([sized array](@ref sizedarrays)) */
};
/**
@@ -261,7 +327,7 @@
char rev[LY_REV_SIZE]; /**< revision date (madatory) */
const char *dsc; /**< description statement */
const char *ref; /**< reference statement */
- struct lysp_ext_instance *exts; /**< list of the extension instances (0-terminated) */
+ struct lysp_ext_instance *exts; /**< list of the extension instances ([sized array](@ref sizedarrays)) */
};
/**
@@ -273,7 +339,7 @@
const char *ref; /**< reference statement */
int64_t value; /**< enum's value or bit's position */
const char **iffeatures; /**< list of if-feature expressions (NULL-terminated) */
- struct lysp_ext_instance *exts; /**< list of the extension instances (0-terminated) */
+ struct lysp_ext_instance *exts; /**< list of the extension instances ([sized array](@ref sizedarrays)) */
uint16_t flags; /**< [schema node flags](@ref snodeflags) - only LYS_STATUS_ and LYS_SET_VALUE
values are allowed */
};
@@ -287,13 +353,13 @@
const char *name; /**< name of the type (mandatory) */
struct lysp_restr *range; /**< allowed values range - numerical, decimal64 */
struct lysp_restr *length; /**< allowed length of the value - string, binary */
- struct lysp_restr *patterns; /**< list of patterns (0-terminated) - string */
- struct lysp_type_enum *enums; /**< list of enum-stmts (0-terminated) - enum */
- struct lysp_type_enum *bits; /**< list of bit-stmts (0-terminated) - bits */
+ struct lysp_restr *patterns; /**< list of patterns ([sized array](@ref sizedarrays)) - string */
+ struct lysp_type_enum *enums; /**< list of enum-stmts ([sized array](@ref sizedarrays)) - enum */
+ struct lysp_type_enum *bits; /**< list of bit-stmts ([sized array](@ref sizedarrays)) - bits */
const char *path; /**< path - leafref */
const char **bases; /**< list of base identifiers (NULL-terminated) - identityref */
- struct lysp_type *types; /**< list of sub-types (0-terminated) - union */
- struct lysp_ext_instance *exts; /**< list of the extension instances (0-terminated) */
+ struct lysp_type *types; /**< list of sub-types ([sized array](@ref sizedarrays)) - union */
+ struct lysp_ext_instance *exts; /**< list of the extension instances ([sized array](@ref sizedarrays)) */
uint8_t fraction_digits; /**< number of fraction digits - decimal64 */
uint8_t require_instance; /**< require-instance flag - leafref, instance */
@@ -309,7 +375,7 @@
const char *dflt; /**< default value of the newly defined type */
const char *dsc; /**< description statement */
const char *ref; /**< reference statement */
- struct lysp_ext_instance *exts; /**< list of the extension instances (0-terminated) */
+ struct lysp_ext_instance *exts; /**< list of the extension instances ([sized array](@ref sizedarrays)) */
struct lysp_type type; /**< base type from which the typedef is derived (mandatory) */
uint16_t flags; /**< [schema node flags](@ref snodeflags) - only LYS_STATUS_* values allowed */
};
@@ -321,12 +387,12 @@
const char *name; /**< grouping name (mandatory) */
const char *dsc; /**< description statement */
const char *ref; /**< reference statement */
- struct lysp_tpdf *typedefs; /**< list of typedefs (0-terminated) */
- struct lysp_grp *groupings; /**< list of groupings (0-terminated) */
+ struct lysp_tpdf *typedefs; /**< list of typedefs ([sized array](@ref sizedarrays)) */
+ struct lysp_grp *groupings; /**< list of groupings ([sized array](@ref sizedarrays)) */
struct lysp_node *data; /**< list of data nodes (linked list) */
- struct lysp_action *actions; /**< list of actions (0-terminated) */
- struct lysp_notif *notifs; /**< list of notifications (0-terminated) */
- struct lysp_ext_instance *exts; /**< list of the extension instances (0-terminated) */
+ struct lysp_action *actions; /**< list of actions ([sized array](@ref sizedarrays)) */
+ struct lysp_notif *notifs; /**< list of notifications ([sized array](@ref sizedarrays)) */
+ struct lysp_ext_instance *exts; /**< list of the extension instances ([sized array](@ref sizedarrays)) */
uint16_t flags; /**< [schema node flags](@ref snodeflags) - only LYS_STATUS_* values are allowed */
};
@@ -337,7 +403,7 @@
const char *cond; /**< specified condition (mandatory) */
const char *dsc; /**< description statement */
const char *ref; /**< reference statement */
- struct lysp_ext_instance *exts; /**< list of the extension instances (0-terminated) */
+ struct lysp_ext_instance *exts; /**< list of the extension instances ([sized array](@ref sizedarrays)) */
};
/**
@@ -348,12 +414,12 @@
const char *dsc; /**< description statement */
const char *ref; /**< reference statement */
const char **iffeatures; /**< list of if-feature expressions (NULL-terminated) */
- struct lysp_restr *musts; /**< list of must restrictions (0-terminated) */
+ struct lysp_restr *musts; /**< list of must restrictions ([sized array](@ref sizedarrays)) */
const char *presence; /**< presence description */
const char **dflts; /**< list of default values (NULL-terminated) */
uint32_t min; /**< min-elements constraint */
uint32_t max; /**< max-elements constraint, 0 means unbounded */
- struct lysp_ext_instance *exts; /**< list of the extension instances (0-terminated) */
+ struct lysp_ext_instance *exts; /**< list of the extension instances ([sized array](@ref sizedarrays)) */
uint16_t flags; /**< [schema node flags](@ref snodeflags) */
};
@@ -367,9 +433,9 @@
struct lysp_when *when; /**< when statement */
const char **iffeatures; /**< list of if-feature expressions (NULL-terminated) */
struct lysp_node *child; /**< list of data nodes (linked list) */
- struct lysp_action *actions; /**< list of actions (0-terminated) */
- struct lysp_notif *notifs; /**< list of notifications (0-terminated) */
- struct lysp_ext_instance *exts; /**< list of the extension instances (0-terminated) */
+ struct lysp_action *actions; /**< list of actions ([sized array](@ref sizedarrays)) */
+ struct lysp_notif *notifs; /**< list of notifications ([sized array](@ref sizedarrays)) */
+ struct lysp_ext_instance *exts; /**< list of the extension instances ([sized array](@ref sizedarrays)) */
uint16_t flags; /**< [schema node flags](@ref snodeflags) - only LYS_STATUS_* values are allowed */
};
@@ -389,15 +455,15 @@
struct lysp_deviate {
uint8_t mod; /**< [type](@ref deviatetypes) of the deviate modification */
struct lysp_deviate *next; /**< next deviate structure in the list */
- struct lysp_ext_instance *exts; /**< list of the extension instances (0-terminated) */
+ struct lysp_ext_instance *exts; /**< list of the extension instances ([sized array](@ref sizedarrays)) */
};
struct lysp_deviate_add {
uint8_t mod; /**< [type](@ref deviatetypes) of the deviate modification */
struct lysp_deviate *next; /**< next deviate structure in the list */
- struct lysp_ext_instance *exts; /**< list of the extension instances (0-terminated) */
+ struct lysp_ext_instance *exts; /**< list of the extension instances ([sized array](@ref sizedarrays)) */
const char *units; /**< units of the values */
- struct lysp_restr *musts; /**< list of must restrictions (0-terminated) */
+ struct lysp_restr *musts; /**< list of must restrictions ([sized array](@ref sizedarrays)) */
const char **uniques; /**< list of uniques specifications (NULL-terminated) */
const char **dflts; /**< list of default values (NULL-terminated) */
uint16_t flags; /**< [schema node flags](@ref snodeflags) */
@@ -408,9 +474,9 @@
struct lysp_deviate_del {
uint8_t mod; /**< [type](@ref deviatetypes) of the deviate modification */
struct lysp_deviate *next; /**< next deviate structure in the list */
- struct lysp_ext_instance *exts; /**< list of the extension instances (0-terminated) */
+ struct lysp_ext_instance *exts; /**< list of the extension instances ([sized array](@ref sizedarrays)) */
const char *units; /**< units of the values */
- struct lysp_restr *musts; /**< list of must restrictions (0-terminated) */
+ struct lysp_restr *musts; /**< list of must restrictions ([sized array](@ref sizedarrays)) */
const char **uniques; /**< list of uniques specifications (NULL-terminated) */
const char **dflts; /**< list of default values (NULL-terminated) */
uint16_t flags; /**< [schema node flags](@ref snodeflags) */
@@ -419,7 +485,7 @@
struct lysp_deviate_rpl {
uint8_t mod; /**< [type](@ref deviatetypes) of the deviate modification */
struct lysp_deviate *next; /**< next deviate structure in the list */
- struct lysp_ext_instance *exts; /**< list of the extension instances (0-terminated) */
+ struct lysp_ext_instance *exts; /**< list of the extension instances ([sized array](@ref sizedarrays)) */
struct lysp_type *type; /**< type of the node */
const char *units; /**< units of the values */
const char *dflt; /**< default value */
@@ -433,7 +499,7 @@
const char *dsc; /**< description statement */
const char *ref; /**< reference statement */
struct lysp_deviate* deviates; /**< list of deviate specifications (linked list) */
- struct lysp_ext_instance *exts; /**< list of the extension instances (0-terminated) */
+ struct lysp_ext_instance *exts; /**< list of the extension instances ([sized array](@ref sizedarrays)) */
};
#define LYS_CONFIG_W 0x01 /**< config true; */
@@ -444,18 +510,20 @@
#define LYS_STATUS_OBSLT 0x20 /**< status obsolete; */
#define LYS_STATUS_MASK 0x38 /**< mask for status value */
#define LYS_MAND_TRUE 0x40 /**< mandatory true; applicable only to
- ::lys_node_choice, ::lys_node_leaf and ::lys_node_anydata */
+ ::lysp_node_choice/::lysc_node_choice, ::lysp_node_leaf/::lysc_node_leaf
+ and ::lysp_node_anydata/::lysc_node_anydata */
#define LYS_MAND_FALSE 0x80 /**< mandatory false; applicable only to
- ::lys_node_choice, ::lys_node_leaf and ::lys_node_anydata */
+ ::lysp_node_choice/::lysc_node_choice, ::lysp_node_leaf/::lysc_node_leaf
+ and ::lysp_node_anydata/::lysc_node_anydata */
#define LYS_MAND_MASK 0xc0 /**< mask for mandatory values */
#define LYS_ORDBY_SYSTEM 0x100 /**< ordered-by system lists, applicable only to
- ::lys_node_list and ::lys_node_leaflist */
+ ::lysp_node_list/lysc_node_list and ::lysp_node_leaflist/::lysc_node_list */
#define LYS_ORDBY_USER 0x200 /**< ordered-by user lists, applicable only to
- ::lys_node_list and ::lys_node_leaflist */
+ ::lysp_node_list/lysc_node_list and ::lysp_node_leaflist/::lysc_node_list */
#define LYS_ORDBY_MASK 0x300 /**< mask for ordered-by flags */
-#define LYS_FENABLED 0x100 /**< feature enabled flag, applicable only to ::lys_feature */
+#define LYS_FENABLED 0x100 /**< feature enabled flag, applicable only to ::lysp_feature/::lysc_feature */
#define LYS_AUTOASSIGNED 0x01 /**< value was auto-assigned, applicable only to
- ::lys_type enum and bits flags */
+ ::lysp_type/::lysc_type enum and bits flags */
#define LYS_YINELEM_TRUE 0x01 /**< yin-element true for extension's argument */
#define LYS_YINELEM_FALSE 0x02 /**< yin-element false for extension's argument */
#define LYS_YINELEM_MASK 0x03 /**< mask for yin-element value */
@@ -476,7 +544,7 @@
const char *ref; /**< reference statement */
struct lysp_when *when; /**< when statement */
const char **iffeatures; /**< list of if-feature expressions (NULL-terminated) */
- struct lysp_ext_instance *exts; /**< list of the extension instances (0-terminated) */
+ struct lysp_ext_instance *exts; /**< list of the extension instances ([sized array](@ref sizedarrays)) */
};
/**
@@ -491,16 +559,16 @@
const char *ref; /**< reference statement */
struct lysp_when *when; /**< when statement */
const char **iffeatures; /**< list of if-feature expressions (NULL-terminated) */
- struct lysp_ext_instance *exts; /**< list of the extension instances (0-terminated) */
+ struct lysp_ext_instance *exts; /**< list of the extension instances ([sized array](@ref sizedarrays)) */
/* container */
- struct lysp_restr *musts; /**< list of must restrictions (0-terminated) */
+ struct lysp_restr *musts; /**< list of must restrictions ([sized array](@ref sizedarrays)) */
const char *presence; /**< presence description */
- struct lysp_tpdf *typedefs; /**< list of typedefs (0-terminated) */
- struct lysp_grp *groupings; /**< list of groupings (0-terminated) */
+ struct lysp_tpdf *typedefs; /**< list of typedefs ([sized array](@ref sizedarrays)) */
+ struct lysp_grp *groupings; /**< list of groupings ([sized array](@ref sizedarrays)) */
struct lysp_node *child; /**< list of data nodes (linked list) */
- struct lysp_action *actions; /**< list of actions (0-terminated) */
- struct lysp_notif *notifs; /**< list of notifications (0-terminated) */
+ struct lysp_action *actions; /**< list of actions ([sized array](@ref sizedarrays)) */
+ struct lysp_notif *notifs; /**< list of notifications ([sized array](@ref sizedarrays)) */
};
struct lysp_node_leaf {
@@ -512,10 +580,10 @@
const char *ref; /**< reference statement */
struct lysp_when *when; /**< when statement */
const char **iffeatures; /**< list of if-feature expressions (NULL-terminated) */
- struct lysp_ext_instance *exts; /**< list of the extension instances (0-terminated) */
+ struct lysp_ext_instance *exts; /**< list of the extension instances ([sized array](@ref sizedarrays)) */
/* leaf */
- struct lysp_restr *musts; /**< list of must restrictions (0-terminated) */
+ struct lysp_restr *musts; /**< list of must restrictions ([sized array](@ref sizedarrays)) */
struct lysp_type type; /**< type of the leaf node (mandatory) */
const char *units; /**< units of the leaf's type */
const char *dflt; /**< default value */
@@ -530,10 +598,10 @@
const char *ref; /**< reference statement */
struct lysp_when *when; /**< when statement */
const char **iffeatures; /**< list of if-feature expressions (NULL-terminated) */
- struct lysp_ext_instance *exts; /**< list of the extension instances (0-terminated) */
+ struct lysp_ext_instance *exts; /**< list of the extension instances ([sized array](@ref sizedarrays)) */
/* leaf-list */
- struct lysp_restr *musts; /**< list of must restrictions (0-terminated) */
+ struct lysp_restr *musts; /**< list of must restrictions ([sized array](@ref sizedarrays)) */
struct lysp_type type; /**< type of the leaf node (mandatory) */
const char *units; /**< units of the leaf's type */
const char **dflts; /**< list of default values (NULL-terminated) */
@@ -550,16 +618,16 @@
const char *ref; /**< reference statement */
struct lysp_when *when; /**< when statement */
const char **iffeatures; /**< list of if-feature expressions (NULL-terminated) */
- struct lysp_ext_instance *exts; /**< list of the extension instances (0-terminated) */
+ struct lysp_ext_instance *exts; /**< list of the extension instances ([sized array](@ref sizedarrays)) */
/* list */
- struct lysp_restr *musts; /**< list of must restrictions (0-terminated) */
+ struct lysp_restr *musts; /**< list of must restrictions ([sized array](@ref sizedarrays)) */
const char *key; /**< keys specification */
- struct lysp_tpdf *typedefs; /**< list of typedefs (0-terminated) */
- struct lysp_grp *groupings; /**< list of groupings (0-terminated) */
+ struct lysp_tpdf *typedefs; /**< list of typedefs ([sized array](@ref sizedarrays)) */
+ struct lysp_grp *groupings; /**< list of groupings ([sized array](@ref sizedarrays)) */
struct lysp_node *child; /**< list of data nodes (linked list) */
- struct lysp_action *actions; /**< list of actions (0-terminated) */
- struct lysp_notif *notifs; /**< list of notifications (0-terminated) */
+ struct lysp_action *actions; /**< list of actions ([sized array](@ref sizedarrays)) */
+ struct lysp_notif *notifs; /**< list of notifications ([sized array](@ref sizedarrays)) */
const char **uniques; /**< list of uniques specifications (NULL-terminated) */
uint32_t min; /**< min-elements constraint */
uint32_t max; /**< max-elements constraint, 0 means unbounded */
@@ -574,7 +642,7 @@
const char *ref; /**< reference statement */
struct lysp_when *when; /**< when statement */
const char **iffeatures; /**< list of if-feature expressions (NULL-terminated) */
- struct lysp_ext_instance *exts; /**< list of the extension instances (0-terminated) */
+ struct lysp_ext_instance *exts; /**< list of the extension instances ([sized array](@ref sizedarrays)) */
/* choice */
struct lysp_node *child; /**< list of data nodes (linked list) */
@@ -590,7 +658,7 @@
const char *ref; /**< reference statement */
struct lysp_when *when; /**< when statement */
const char **iffeatures; /**< list of if-feature expressions (NULL-terminated) */
- struct lysp_ext_instance *exts; /**< list of the extension instances (0-terminated) */
+ struct lysp_ext_instance *exts; /**< list of the extension instances ([sized array](@ref sizedarrays)) */
/* case */
struct lysp_node *child; /**< list of data nodes (linked list) */
@@ -605,10 +673,10 @@
const char *ref; /**< reference statement */
struct lysp_when *when; /**< when statement */
const char **iffeatures; /**< list of if-feature expressions (NULL-terminated) */
- struct lysp_ext_instance *exts; /**< list of the extension instances (0-terminated) */
+ struct lysp_ext_instance *exts; /**< list of the extension instances ([sized array](@ref sizedarrays)) */
/* anyxml/anydata */
- struct lysp_restr *musts; /**< list of must restrictions (0-terminated) */
+ struct lysp_restr *musts; /**< list of must restrictions ([sized array](@ref sizedarrays)) */
};
struct lysp_node_uses {
@@ -620,22 +688,22 @@
const char *ref; /**< reference statement */
struct lysp_when *when; /**< when statement */
const char **iffeatures; /**< list of if-feature expressions (NULL-terminated) */
- struct lysp_ext_instance *exts; /**< list of the extension instances (0-terminated) */
+ struct lysp_ext_instance *exts; /**< list of the extension instances ([sized array](@ref sizedarrays)) */
/* uses */
- struct lysp_refine *refines; /**< list of uses's refines (0-terminated) */
- struct lysp_augment *augments; /**< list of uses's augment (0-terminated) */
+ struct lysp_refine *refines; /**< list of uses's refines ([sized array](@ref sizedarrays)) */
+ struct lysp_augment *augments; /**< list of uses's augment ([sized array](@ref sizedarrays)) */
};
/**
* @brief YANG input-stmt and output-stmt
*/
struct lysp_action_inout {
- struct lysp_restr *musts; /**< list of must restrictions (0-terminated) */
- struct lysp_tpdf *typedefs; /**< list of typedefs (0-terminated) */
- struct lysp_grp *groupings; /**< list of groupings (0-terminated) */
+ struct lysp_restr *musts; /**< list of must restrictions ([sized array](@ref sizedarrays)) */
+ struct lysp_tpdf *typedefs; /**< list of typedefs ([sized array](@ref sizedarrays)) */
+ struct lysp_grp *groupings; /**< list of groupings ([sized array](@ref sizedarrays)) */
struct lysp_node *data; /**< list of data nodes (linked list) */
- struct lysp_ext_instance *exts; /**< list of the extension instances (0-terminated) */
+ struct lysp_ext_instance *exts; /**< list of the extension instances ([sized array](@ref sizedarrays)) */
};
/**
@@ -646,11 +714,11 @@
const char *dsc; /**< description statement */
const char *ref; /**< reference statement */
const char **iffeatures; /**< list of if-feature expressions (NULL-terminated) */
- struct lysp_tpdf *typedefs; /**< list of typedefs (0-terminated) */
- struct lysp_grp *groupings; /**< list of groupings (0-terminated) */
+ struct lysp_tpdf *typedefs; /**< list of typedefs ([sized array](@ref sizedarrays)) */
+ struct lysp_grp *groupings; /**< list of groupings ([sized array](@ref sizedarrays)) */
struct lysp_action_inout *input; /**< RPC's/Action's input */
struct lysp_action_inout *output;/**< RPC's/Action's output */
- struct lysp_ext_instance *exts; /**< list of the extension instances (0-terminated) */
+ struct lysp_ext_instance *exts; /**< list of the extension instances ([sized array](@ref sizedarrays)) */
uint16_t flags; /**< [schema node flags](@ref snodeflags) */
};
@@ -662,11 +730,11 @@
const char *dsc; /**< description statement */
const char *ref; /**< reference statement */
const char **iffeatures; /**< list of if-feature expressions (NULL-terminated) */
- struct lysp_restr *musts; /**< list of must restrictions (0-terminated) */
- struct lysp_tpdf *typedefs; /**< list of typedefs (0-terminated) */
- struct lysp_grp *groupings; /**< list of groupings (0-terminated) */
+ struct lysp_restr *musts; /**< list of must restrictions ([sized array](@ref sizedarrays)) */
+ struct lysp_tpdf *typedefs; /**< list of typedefs ([sized array](@ref sizedarrays)) */
+ struct lysp_grp *groupings; /**< list of groupings ([sized array](@ref sizedarrays)) */
struct lysp_node *data; /**< list of data nodes (linked list) */
- struct lysp_ext_instance *exts; /**< list of the extension instances (0-terminated) */
+ struct lysp_ext_instance *exts; /**< list of the extension instances ([sized array](@ref sizedarrays)) */
uint16_t flags; /**< [schema node flags](@ref snodeflags) - only LYS_STATUS_* values are allowed */
};
@@ -695,25 +763,25 @@
const char *belongsto; /**< belongs to parent module (submodule - mandatory) */
};
const char *prefix; /**< module prefix or submodule belongsto prefix of main module (mandatory) */
- struct lysp_import *imports; /**< list of imported modules (0-terminated) */
- struct lysp_include *includes; /**< list of included submodules (0-terminated) */
+ struct lysp_import *imports; /**< list of imported modules ([sized array](@ref sizedarrays)) */
+ struct lysp_include *includes; /**< list of included submodules ([sized array](@ref sizedarrays)) */
const char *org; /**< party/company responsible for the module */
const char *contact; /**< contact information for the module */
const char *dsc; /**< description of the module */
const char *ref; /**< cross-reference for the module */
- struct lysp_revision *revs; /**< list of the module revisions (0-terminated), the first revision
+ struct lysp_revision *revs; /**< list of the module revisions ([sized array](@ref sizedarrays)), the first revision
in the list is always the last (newest) revision of the module */
- struct lysp_ext *extensions; /**< list of extension statements (0-terminated) */
- struct lysp_feature *features; /**< list of feature definitions (0-terminated) */
- struct lysp_ident *identities; /**< list of identities (0-terminated) */
- struct lysp_tpdf *typedefs; /**< list of typedefs (0-terminated) */
- struct lysp_grp *groupings; /**< list of groupings (0-terminated) */
+ struct lysp_ext *extensions; /**< list of extension statements ([sized array](@ref sizedarrays)) */
+ struct lysp_feature *features; /**< list of feature definitions ([sized array](@ref sizedarrays)) */
+ struct lysp_ident *identities; /**< list of identities ([sized array](@ref sizedarrays)) */
+ struct lysp_tpdf *typedefs; /**< list of typedefs ([sized array](@ref sizedarrays)) */
+ struct lysp_grp *groupings; /**< list of groupings ([sized array](@ref sizedarrays)) */
struct lysp_node *data; /**< list of module's top-level data nodes (linked list) */
- struct lysp_augment *augments; /**< list of augments (0-terminated) */
- struct lysp_action *rpcs; /**< list of RPCs (0-terminated) */
- struct lysp_notif *notifs; /**< list of notifications (0-terminated) */
- struct lysp_deviation *deviations; /**< list of deviations (0-terminated) */
- struct lysp_ext_instance *exts; /**< list of the extension instances (0-terminated) */
+ struct lysp_augment *augments; /**< list of augments ([sized array](@ref sizedarrays)) */
+ struct lysp_action *rpcs; /**< list of RPCs ([sized array](@ref sizedarrays)) */
+ struct lysp_notif *notifs; /**< list of notifications ([sized array](@ref sizedarrays)) */
+ struct lysp_deviation *deviations; /**< list of deviations ([sized array](@ref sizedarrays)) */
+ struct lysp_ext_instance *exts; /**< list of the extension instances ([sized array](@ref sizedarrays)) */
uint8_t submodule:1; /**< flag to distinguish main modules and submodules */
uint8_t implemented:1; /**< flag if the module is implemented, not just imported */
@@ -734,7 +802,7 @@
*/
struct lysc_when {
struct lyxp_expr *cond; /**< XPath when condition */
- struct lysc_ext_instance *exts; /**< list of the extension instances (0-terminated) */
+ struct lysc_ext_instance *exts; /**< list of the extension instances ([sized array](@ref sizedarrays)) */
};
/**
@@ -742,9 +810,9 @@
*/
struct lysc_feature {
const char *name; /**< feature name (mandatory) */
- struct lysc_feature *depfeatures;/**< list of other features depending on this one (0-terminated) */
- struct lysc_iffeature *iffeatures; /**< list of if-feature expressions (0-terminated) */
- struct lysp_ext_instance *exts; /**< list of the extension instances (0-terminated) */
+ struct lysc_feature *depfeatures;/**< list of other features depending on this one ([sized array](@ref sizedarrays)) */
+ struct lysc_iffeature *iffeatures; /**< list of if-feature expressions ([sized array](@ref sizedarrays)) */
+ struct lysp_ext_instance *exts; /**< list of the extension instances ([sized array](@ref sizedarrays)) */
uint16_t flags; /**< [schema node flags](@ref snodeflags) - only LYS_STATUS_* and
#LYS_FENABLED values allowed */
};
@@ -764,8 +832,8 @@
struct lysc_node *next; /**< pointer to the next sibling node (NULL if there is no one) */
const char *name; /**< node name (mandatory) */
struct lysc_when *when; /**< when statement */
- struct lysc_iffeature *iffeatures; /**< list of if-feature expressions (0-terminated) */
- struct lysc_ext_instance *exts; /**< list of the extension instances (0-terminated) */
+ struct lysc_iffeature *iffeatures; /**< list of if-feature expressions ([sized array](@ref sizedarrays)) */
+ struct lysc_ext_instance *exts; /**< list of the extension instances ([sized array](@ref sizedarrays)) */
};
/**
@@ -781,7 +849,7 @@
const char *prefix; /**< module prefix (mandatory) */
- struct lysc_feature *features; /**< list of feature definitions (0-terminated) */
+ struct lysc_feature *features; /**< list of feature definitions ([sized array](@ref sizedarrays)) */
uint8_t implemented:1; /**< flag if the module is implemented, not just imported */