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/printer_yang.c b/src/printer_yang.c
index 2b64651..25012b2 100755
--- a/src/printer_yang.c
+++ b/src/printer_yang.c
@@ -221,15 +221,15 @@
*/
static void
yprp_extension_instances(struct ypr_ctx *ctx, LYEXT_SUBSTMT substmt, uint8_t substmt_index,
- struct lysp_ext_instance *ext, int *flag, LY_ARRAY_SIZE_TYPE count)
+ struct lysp_ext_instance *ext, int *flag, LY_ARRAY_COUNT_TYPE count)
{
- LY_ARRAY_SIZE_TYPE u;
+ LY_ARRAY_COUNT_TYPE u;
struct lysp_stmt *stmt;
int child_presence;
const char *argument;
if (!count && ext) {
- count = LY_ARRAY_SIZE(ext);
+ count = LY_ARRAY_COUNT(ext);
}
LY_ARRAY_FOR(ext, u) {
if (!count) {
@@ -288,12 +288,12 @@
*/
static void
yprc_extension_instances(struct ypr_ctx *ctx, LYEXT_SUBSTMT substmt, uint8_t substmt_index,
- struct lysc_ext_instance *ext, int *flag, LY_ARRAY_SIZE_TYPE count)
+ struct lysc_ext_instance *ext, int *flag, LY_ARRAY_COUNT_TYPE count)
{
- LY_ARRAY_SIZE_TYPE u;
+ LY_ARRAY_COUNT_TYPE u;
if (!count && ext) {
- count = LY_ARRAY_SIZE(ext);
+ count = LY_ARRAY_COUNT(ext);
}
LY_ARRAY_FOR(ext, u) {
if (!count) {
@@ -312,7 +312,7 @@
static void
ypr_substmt(struct ypr_ctx *ctx, LYEXT_SUBSTMT substmt, uint8_t substmt_index, const char *text, void *ext)
{
- LY_ARRAY_SIZE_TYPE u;
+ LY_ARRAY_COUNT_TYPE u;
int extflag = 0;
if (!text) {
@@ -446,7 +446,7 @@
static void
yprp_iffeatures(struct ypr_ctx *ctx, const char **iff, struct lysp_ext_instance *exts, int *flag)
{
- LY_ARRAY_SIZE_TYPE u;
+ LY_ARRAY_COUNT_TYPE u;
int extflag;
LY_ARRAY_FOR(iff, u) {
@@ -514,7 +514,7 @@
static void
yprc_iffeatures(struct ypr_ctx *ctx, struct lysc_iffeature *iff, struct lysc_ext_instance *exts, int *flag)
{
- LY_ARRAY_SIZE_TYPE u, v;
+ LY_ARRAY_COUNT_TYPE u, v;
int extflag;
LY_ARRAY_FOR(iff, u) {
@@ -544,7 +544,7 @@
yprp_extension(struct ypr_ctx *ctx, const struct lysp_ext *ext)
{
int flag = 0, flag2 = 0;
- LY_ARRAY_SIZE_TYPE u;
+ LY_ARRAY_COUNT_TYPE u;
ly_print(ctx->out, "%*sextension %s", INDENT, ext->name);
LEVEL++;
@@ -559,12 +559,12 @@
LEVEL++;
if (ext->exts) {
u = -1;
- while ((u = lysp_ext_instance_iter(ext->exts, u + 1, LYEXT_SUBSTMT_ARGUMENT)) != LY_ARRAY_SIZE(ext->exts)) {
+ while ((u = lysp_ext_instance_iter(ext->exts, u + 1, LYEXT_SUBSTMT_ARGUMENT)) != LY_ARRAY_COUNT(ext->exts)) {
yprp_extension_instances(ctx, LYEXT_SUBSTMT_ARGUMENT, 0, &ext->exts[u], &flag2, 1);
}
}
if ((ext->flags & LYS_YINELEM_MASK) ||
- (ext->exts && lysp_ext_instance_iter(ext->exts, 0, LYEXT_SUBSTMT_YINELEM) != LY_ARRAY_SIZE(ext->exts))) {
+ (ext->exts && lysp_ext_instance_iter(ext->exts, 0, LYEXT_SUBSTMT_YINELEM) != LY_ARRAY_COUNT(ext->exts))) {
ypr_open(ctx->out, &flag2);
ypr_substmt(ctx, LYEXT_SUBSTMT_YINELEM, 0, (ext->flags & LYS_YINELEM_TRUE) ? "true" : "false", ext->exts);
}
@@ -616,7 +616,7 @@
yprp_identity(struct ypr_ctx *ctx, const struct lysp_ident *ident)
{
int flag = 0;
- LY_ARRAY_SIZE_TYPE u;
+ LY_ARRAY_COUNT_TYPE u;
ly_print(ctx->out, "\n%*sidentity %s", INDENT, ident->name);
LEVEL++;
@@ -641,7 +641,7 @@
yprc_identity(struct ypr_ctx *ctx, const struct lysc_ident *ident)
{
int flag = 0;
- LY_ARRAY_SIZE_TYPE u;
+ LY_ARRAY_COUNT_TYPE u;
ly_print(ctx->out, "\n%*sidentity %s", INDENT, ident->name);
LEVEL++;
@@ -733,7 +733,7 @@
yprc_range(struct ypr_ctx *ctx, const struct lysc_range *range, LY_DATA_TYPE basetype, int *flag)
{
int inner_flag = 0;
- LY_ARRAY_SIZE_TYPE u;
+ LY_ARRAY_COUNT_TYPE u;
if (!range) {
return;
@@ -857,7 +857,7 @@
static void
yprp_enum(struct ypr_ctx *ctx, const struct lysp_type_enum *items, LY_DATA_TYPE type, int *flag)
{
- LY_ARRAY_SIZE_TYPE u;
+ LY_ARRAY_COUNT_TYPE u;
int inner_flag;
LY_ARRAY_FOR(items, u) {
@@ -891,7 +891,7 @@
static void
yprp_type(struct ypr_ctx *ctx, const struct lysp_type *type)
{
- LY_ARRAY_SIZE_TYPE u;
+ LY_ARRAY_COUNT_TYPE u;
int flag = 0;
ly_print(ctx->out, "%*stype %s", INDENT, type->name);
@@ -947,7 +947,7 @@
static void
yprc_type(struct ypr_ctx *ctx, const struct lysc_type *type)
{
- LY_ARRAY_SIZE_TYPE u;
+ LY_ARRAY_COUNT_TYPE u;
int flag = 0;
ly_print(ctx->out, "%*stype %s", INDENT, lys_datatype2str(type->basetype));
@@ -1097,7 +1097,7 @@
static void
yprp_grouping(struct ypr_ctx *ctx, const struct lysp_grp *grp)
{
- LY_ARRAY_SIZE_TYPE u;
+ LY_ARRAY_COUNT_TYPE u;
int flag = 0;
struct lysp_node *data;
@@ -1137,7 +1137,7 @@
static void
yprp_inout(struct ypr_ctx *ctx, const struct lysp_action_inout *inout, int *flag)
{
- LY_ARRAY_SIZE_TYPE u;
+ LY_ARRAY_COUNT_TYPE u;
struct lysp_node *data;
if (!inout->nodetype) {
@@ -1171,7 +1171,7 @@
static void
yprc_inout(struct ypr_ctx *ctx, const struct lysc_action *action, const struct lysc_action_inout *inout, int *flag)
{
- LY_ARRAY_SIZE_TYPE u;
+ LY_ARRAY_COUNT_TYPE u;
struct lysc_node *data;
if (!inout->data) {
@@ -1201,7 +1201,7 @@
static void
yprp_notification(struct ypr_ctx *ctx, const struct lysp_notif *notif)
{
- LY_ARRAY_SIZE_TYPE u;
+ LY_ARRAY_COUNT_TYPE u;
int flag = 0;
struct lysp_node *data;
@@ -1242,7 +1242,7 @@
static void
yprc_notification(struct ypr_ctx *ctx, const struct lysc_notif *notif)
{
- LY_ARRAY_SIZE_TYPE u;
+ LY_ARRAY_COUNT_TYPE u;
int flag = 0;
struct lysc_node *data;
@@ -1275,7 +1275,7 @@
static void
yprp_action(struct ypr_ctx *ctx, const struct lysp_action *action)
{
- LY_ARRAY_SIZE_TYPE u;
+ LY_ARRAY_COUNT_TYPE u;
int flag = 0;
LYOUT_CHECK(ctx->out);
@@ -1343,7 +1343,7 @@
static void
yprc_node_common1(struct ypr_ctx *ctx, const struct lysc_node *node, int *flag)
{
- LY_ARRAY_SIZE_TYPE u;
+ LY_ARRAY_COUNT_TYPE u;
ly_print(ctx->out, "%*s%s %s%s", INDENT, lys_nodetype2str(node->nodetype), node->name, flag ? "" : " {\n");
LEVEL++;
@@ -1382,7 +1382,7 @@
static void
yprp_container(struct ypr_ctx *ctx, const struct lysp_node *node)
{
- LY_ARRAY_SIZE_TYPE u;
+ LY_ARRAY_COUNT_TYPE u;
int flag = 0;
struct lysp_node *child;
struct lysp_node_container *cont = (struct lysp_node_container *)node;
@@ -1431,7 +1431,7 @@
static void
yprc_container(struct ypr_ctx *ctx, const struct lysc_node *node)
{
- LY_ARRAY_SIZE_TYPE u;
+ LY_ARRAY_COUNT_TYPE u;
int flag = 0;
struct lysc_node *child;
struct lysc_node_container *cont = (struct lysc_node_container *)node;
@@ -1561,7 +1561,7 @@
static void
yprp_leaf(struct ypr_ctx *ctx, const struct lysp_node *node)
{
- LY_ARRAY_SIZE_TYPE u;
+ LY_ARRAY_COUNT_TYPE u;
struct lysp_node_leaf *leaf = (struct lysp_node_leaf *)node;
yprp_node_common1(ctx, node, NULL);
@@ -1582,7 +1582,7 @@
static void
yprc_leaf(struct ypr_ctx *ctx, const struct lysc_node *node)
{
- LY_ARRAY_SIZE_TYPE u;
+ LY_ARRAY_COUNT_TYPE u;
struct lysc_node_leaf *leaf = (struct lysc_node_leaf *)node;
yprc_node_common1(ctx, node, NULL);
@@ -1606,7 +1606,7 @@
static void
yprp_leaflist(struct ypr_ctx *ctx, const struct lysp_node *node)
{
- LY_ARRAY_SIZE_TYPE u;
+ LY_ARRAY_COUNT_TYPE u;
struct lysp_node_leaflist *llist = (struct lysp_node_leaflist *)node;
yprp_node_common1(ctx, node, NULL);
@@ -1648,7 +1648,7 @@
static void
yprc_leaflist(struct ypr_ctx *ctx, const struct lysc_node *node)
{
- LY_ARRAY_SIZE_TYPE u;
+ LY_ARRAY_COUNT_TYPE u;
struct lysc_node_leaflist *llist = (struct lysc_node_leaflist *)node;
yprc_node_common1(ctx, node, NULL);
@@ -1684,7 +1684,7 @@
static void
yprp_list(struct ypr_ctx *ctx, const struct lysp_node *node)
{
- LY_ARRAY_SIZE_TYPE u;
+ LY_ARRAY_COUNT_TYPE u;
int flag = 0;
struct lysp_node *child;
struct lysp_node_list *list = (struct lysp_node_list *)node;
@@ -1756,7 +1756,7 @@
static void
yprc_list(struct ypr_ctx *ctx, const struct lysc_node *node)
{
- LY_ARRAY_SIZE_TYPE u, v;
+ LY_ARRAY_COUNT_TYPE u, v;
int flag = 0;
struct lysc_node *child;
struct lysc_node_list *list = (struct lysc_node_list *)node;
@@ -1822,7 +1822,7 @@
static void
yprp_refine(struct ypr_ctx *ctx, struct lysp_refine *refine)
{
- LY_ARRAY_SIZE_TYPE u;
+ LY_ARRAY_COUNT_TYPE u;
int flag = 0;
ly_print(ctx->out, "%*srefine \"%s\"", INDENT, refine->nodeid);
@@ -1872,7 +1872,7 @@
static void
yprp_augment(struct ypr_ctx *ctx, const struct lysp_augment *aug)
{
- LY_ARRAY_SIZE_TYPE u;
+ LY_ARRAY_COUNT_TYPE u;
struct lysp_node *child;
ly_print(ctx->out, "%*saugment \"%s\" {\n", INDENT, aug->nodeid);
@@ -1905,7 +1905,7 @@
static void
yprp_uses(struct ypr_ctx *ctx, const struct lysp_node *node)
{
- LY_ARRAY_SIZE_TYPE u;
+ LY_ARRAY_COUNT_TYPE u;
int flag = 0;
struct lysp_node_uses *uses = (struct lysp_node_uses *)node;
@@ -1929,7 +1929,7 @@
static void
yprp_anydata(struct ypr_ctx *ctx, const struct lysp_node *node)
{
- LY_ARRAY_SIZE_TYPE u;
+ LY_ARRAY_COUNT_TYPE u;
int flag = 0;
struct lysp_node_anydata *any = (struct lysp_node_anydata *)node;
@@ -1949,7 +1949,7 @@
static void
yprc_anydata(struct ypr_ctx *ctx, const struct lysc_node *node)
{
- LY_ARRAY_SIZE_TYPE u;
+ LY_ARRAY_COUNT_TYPE u;
int flag = 0;
struct lysc_node_anydata *any = (struct lysc_node_anydata *)node;
@@ -2035,7 +2035,7 @@
static void
yprp_deviation(struct ypr_ctx *ctx, const struct lysp_deviation *deviation)
{
- LY_ARRAY_SIZE_TYPE u;
+ LY_ARRAY_COUNT_TYPE u;
struct lysp_deviate_add *add;
struct lysp_deviate_rpl *rpl;
struct lysp_deviate_del *del;
@@ -2180,7 +2180,7 @@
LY_ERR
yang_print_parsed(struct ly_out *out, const struct lys_module *module)
{
- LY_ARRAY_SIZE_TYPE u;
+ LY_ARRAY_COUNT_TYPE u;
struct lysp_node *data;
struct lysp_module *modp = module->parsed;
struct ypr_ctx ctx_ = {.out = out, .level = 0, .module = module, .schema = YPR_PARSED}, *ctx = &ctx_;
@@ -2316,7 +2316,7 @@
LY_ERR
yang_print_compiled(struct ly_out *out, const struct lys_module *module, int options)
{
- LY_ARRAY_SIZE_TYPE u;
+ LY_ARRAY_COUNT_TYPE u;
struct lysc_node *data;
struct lysc_module *modc = module->compiled;
struct ypr_ctx ctx_ = {.out = out, .level = 0, .module = module, .options = options}, *ctx = &ctx_;