lyb REFACTOR removed function declarations
diff --git a/src/parser_lyb.c b/src/parser_lyb.c
index 254f082..d84bb1f 100644
--- a/src/parser_lyb.c
+++ b/src/parser_lyb.c
@@ -43,8 +43,6 @@
         struct lyd_node **first_p, struct ly_in *in, uint32_t parse_opts, uint32_t val_opts, uint32_t int_opts,
         struct ly_set *parsed, struct lyd_ctx **lydctx_p);
 
-static LY_ERR lyb_parse_node_inner(struct lyd_lyb_ctx *lybctx, struct lyd_node *parent, const struct lysc_node *snode, struct lyd_node **first_p, struct ly_set *parsed);
-static LY_ERR lyb_parse_node_header(struct lyd_lyb_ctx *lybctx, uint32_t *flags, struct lyd_meta **meta);
 static LY_ERR lyb_parse_siblings(struct lyd_lyb_ctx *lybctx, struct lyd_node *parent, struct lyd_node **first_p, struct ly_set *parsed);
 
 void
@@ -931,6 +929,29 @@
 }
 
 /**
+ * @brief Parse header for non-opaq node.
+ *
+ * @param[in] lybctx LYB context.
+ * @param[out] flags Parsed node flags.
+ * @param[out] meta Parsed metadata of the node.
+ * @return LY_ERR value.
+ */
+static LY_ERR
+lyb_parse_node_header(struct lyd_lyb_ctx *lybctx, uint32_t *flags, struct lyd_meta **meta)
+{
+    LY_ERR ret;
+
+    /* create and read metadata */
+    ret = lyb_parse_metadata(lybctx, meta);
+    LY_CHECK_RET(ret);
+
+    /* read flags */
+    lyb_read_number(flags, sizeof *flags, sizeof *flags, lybctx->lybctx);
+
+    return ret;
+}
+
+/**
  * @brief Create term node and fill it with value.
  *
  * @param[in] lybctx LYB context.
@@ -1181,29 +1202,6 @@
 }
 
 /**
- * @brief Parse header for non-opaq node.
- *
- * @param[in] lybctx LYB context.
- * @param[out] flags Parsed node flags.
- * @param[out] meta Parsed metadata of the node.
- * @return LY_ERR value.
- */
-static LY_ERR
-lyb_parse_node_header(struct lyd_lyb_ctx *lybctx, uint32_t *flags, struct lyd_meta **meta)
-{
-    LY_ERR ret;
-
-    /* create and read metadata */
-    ret = lyb_parse_metadata(lybctx, meta);
-    LY_CHECK_RET(ret);
-
-    /* read flags */
-    lyb_read_number(flags, sizeof *flags, sizeof *flags, lybctx->lybctx);
-
-    return ret;
-}
-
-/**
  * @brief Parse inner node.
  *
  * @param[in] lybctx LYB context.
diff --git a/src/printer_lyb.c b/src/printer_lyb.c
index 22ec8a2..71f6faa 100644
--- a/src/printer_lyb.c
+++ b/src/printer_lyb.c
@@ -38,11 +38,7 @@
 #include "tree_schema_internal.h"
 #include "xml.h"
 
-static LY_ERR lyb_print_schema_hash(struct ly_out *out, struct lysc_node *schema, struct hash_table **sibling_ht, struct lylyb_ctx *lybctx);
-static LY_ERR lyb_print_attributes(struct ly_out *out, const struct lyd_node_opaq *node, struct lylyb_ctx *lybctx);
-static LY_ERR lyb_print_node_inner(struct ly_out *out, const struct lyd_node *node, struct lyd_lyb_ctx *lybctx);
 static LY_ERR lyb_print_siblings(struct ly_out *out, const struct lyd_node *node, struct lyd_lyb_ctx *lybctx);
-static LY_ERR lyb_print_node_header(struct ly_out *out, const struct lyd_node *node, struct lyd_lyb_ctx *lybctx);
 
 /**
  * @brief Hash table equal callback for checking hash equality only.
@@ -616,106 +612,6 @@
 }
 
 /**
- * @brief Print opaque node and its descendants.
- *
- * @param[in] out Out structure.
- * @param[in] opaq Node to print.
- * @param[in] lyd_lybctx LYB context.
- * @return LY_ERR value.
- */
-static LY_ERR
-lyb_print_node_opaq(struct ly_out *out, const struct lyd_node_opaq *opaq, struct lyd_lyb_ctx *lyd_lybctx)
-{
-    struct lylyb_ctx *lybctx = lyd_lybctx->lybctx;
-
-    /* write attributes */
-    LY_CHECK_RET(lyb_print_attributes(out, opaq, lybctx));
-
-    /* write node flags */
-    LY_CHECK_RET(lyb_write_number(opaq->flags, sizeof opaq->flags, out, lybctx));
-
-    /* prefix */
-    LY_CHECK_RET(lyb_write_string(opaq->name.prefix, 0, 1, out, lybctx));
-
-    /* module reference */
-    LY_CHECK_RET(lyb_write_string(opaq->name.module_name, 0, 1, out, lybctx));
-
-    /* name */
-    LY_CHECK_RET(lyb_write_string(opaq->name.name, 0, 1, out, lybctx));
-
-    /* value */
-    LY_CHECK_RET(lyb_write_string(opaq->value, 0, 1, out, lybctx));
-
-    /* format */
-    LY_CHECK_RET(lyb_write_number(opaq->format, 1, out, lybctx));
-
-    /* value prefixes */
-    LY_CHECK_RET(lyb_print_prefix_data(out, opaq->format, opaq->val_prefix_data, lybctx));
-
-    /* recursively write all the descendants */
-    LY_CHECK_RET(lyb_print_siblings(out, opaq->child, lyd_lybctx));
-
-    return LY_SUCCESS;
-}
-
-/**
- * @brief Print anydata or anyxml node.
- *
- * @param[in] anydata Node to print.
- * @param[in] out Out structure.
- * @param[in] lyd_lybctx LYB context.
- * @return LY_ERR value.
- */
-static LY_ERR
-lyb_print_node_any(struct ly_out *out, struct lyd_node_any *anydata, struct lyd_lyb_ctx *lyd_lybctx)
-{
-    LY_ERR ret = LY_SUCCESS;
-    LYD_ANYDATA_VALUETYPE value_type;
-    int len;
-    char *buf = NULL;
-    const char *str;
-    struct ly_out *out2 = NULL;
-    struct lylyb_ctx *lybctx = lyd_lybctx->lybctx;
-
-    if (anydata->value_type == LYD_ANYDATA_DATATREE) {
-        /* will be printed as a nested LYB data tree */
-        value_type = LYD_ANYDATA_LYB;
-    } else {
-        value_type = anydata->value_type;
-    }
-
-    /* write necessary basic data */
-    LY_CHECK_RET(lyb_print_node_header(out, (struct lyd_node *)anydata, lyd_lybctx));
-
-    /* first byte is type */
-    LY_CHECK_GOTO(ret = lyb_write_number(value_type, sizeof value_type, out, lybctx), cleanup);
-
-    if (anydata->value_type == LYD_ANYDATA_DATATREE) {
-        /* print LYB data tree to memory */
-        LY_CHECK_GOTO(ret = ly_out_new_memory(&buf, 0, &out2), cleanup);
-        LY_CHECK_GOTO(ret = lyb_print_data(out2, anydata->value.tree, LYD_PRINT_WITHSIBLINGS), cleanup);
-
-        len = lyd_lyb_data_length(buf);
-        assert(len != -1);
-        str = buf;
-    } else if (anydata->value_type == LYD_ANYDATA_LYB) {
-        len = lyd_lyb_data_length(anydata->value.mem);
-        assert(len != -1);
-        str = anydata->value.mem;
-    } else {
-        len = strlen(anydata->value.str);
-        str = anydata->value.str;
-    }
-
-    /* followed by the content */
-    LY_CHECK_GOTO(ret = lyb_write_string(str, (size_t)len, 1, out, lybctx), cleanup);
-
-cleanup:
-    ly_out_free(out2, NULL, 1);
-    return ret;
-}
-
-/**
  * @brief Print term node.
  *
  * @param[in] term Node to print.
@@ -911,26 +807,6 @@
 }
 
 /**
- * @brief Print header for non-opaq node.
- *
- * @param[in] out Out structure.
- * @param[in] node Current data node to print.
- * @param[in] lybctx LYB context.
- * @return LY_ERR value.
- */
-static LY_ERR
-lyb_print_node_header(struct ly_out *out, const struct lyd_node *node, struct lyd_lyb_ctx *lybctx)
-{
-    /* write any metadata */
-    LY_CHECK_RET(lyb_print_metadata(out, node, lybctx));
-
-    /* write node flags */
-    LY_CHECK_RET(lyb_write_number(node->flags, sizeof node->flags, out, lybctx->lybctx));
-
-    return LY_SUCCESS;
-}
-
-/**
  * @brief Print schema node hash.
  *
  * @param[in] out Out structure.
@@ -1008,6 +884,26 @@
 }
 
 /**
+ * @brief Print header for non-opaq node.
+ *
+ * @param[in] out Out structure.
+ * @param[in] node Current data node to print.
+ * @param[in] lybctx LYB context.
+ * @return LY_ERR value.
+ */
+static LY_ERR
+lyb_print_node_header(struct ly_out *out, const struct lyd_node *node, struct lyd_lyb_ctx *lybctx)
+{
+    /* write any metadata */
+    LY_CHECK_RET(lyb_print_metadata(out, node, lybctx));
+
+    /* write node flags */
+    LY_CHECK_RET(lyb_write_number(node->flags, sizeof node->flags, out, lybctx->lybctx));
+
+    return LY_SUCCESS;
+}
+
+/**
  * @brief Print inner node.
  *
  * @param[in] out Out structure.
@@ -1028,6 +924,106 @@
 }
 
 /**
+ * @brief Print opaque node and its descendants.
+ *
+ * @param[in] out Out structure.
+ * @param[in] opaq Node to print.
+ * @param[in] lyd_lybctx LYB context.
+ * @return LY_ERR value.
+ */
+static LY_ERR
+lyb_print_node_opaq(struct ly_out *out, const struct lyd_node_opaq *opaq, struct lyd_lyb_ctx *lyd_lybctx)
+{
+    struct lylyb_ctx *lybctx = lyd_lybctx->lybctx;
+
+    /* write attributes */
+    LY_CHECK_RET(lyb_print_attributes(out, opaq, lybctx));
+
+    /* write node flags */
+    LY_CHECK_RET(lyb_write_number(opaq->flags, sizeof opaq->flags, out, lybctx));
+
+    /* prefix */
+    LY_CHECK_RET(lyb_write_string(opaq->name.prefix, 0, 1, out, lybctx));
+
+    /* module reference */
+    LY_CHECK_RET(lyb_write_string(opaq->name.module_name, 0, 1, out, lybctx));
+
+    /* name */
+    LY_CHECK_RET(lyb_write_string(opaq->name.name, 0, 1, out, lybctx));
+
+    /* value */
+    LY_CHECK_RET(lyb_write_string(opaq->value, 0, 1, out, lybctx));
+
+    /* format */
+    LY_CHECK_RET(lyb_write_number(opaq->format, 1, out, lybctx));
+
+    /* value prefixes */
+    LY_CHECK_RET(lyb_print_prefix_data(out, opaq->format, opaq->val_prefix_data, lybctx));
+
+    /* recursively write all the descendants */
+    LY_CHECK_RET(lyb_print_siblings(out, opaq->child, lyd_lybctx));
+
+    return LY_SUCCESS;
+}
+
+/**
+ * @brief Print anydata or anyxml node.
+ *
+ * @param[in] anydata Node to print.
+ * @param[in] out Out structure.
+ * @param[in] lyd_lybctx LYB context.
+ * @return LY_ERR value.
+ */
+static LY_ERR
+lyb_print_node_any(struct ly_out *out, struct lyd_node_any *anydata, struct lyd_lyb_ctx *lyd_lybctx)
+{
+    LY_ERR ret = LY_SUCCESS;
+    LYD_ANYDATA_VALUETYPE value_type;
+    int len;
+    char *buf = NULL;
+    const char *str;
+    struct ly_out *out2 = NULL;
+    struct lylyb_ctx *lybctx = lyd_lybctx->lybctx;
+
+    if (anydata->value_type == LYD_ANYDATA_DATATREE) {
+        /* will be printed as a nested LYB data tree */
+        value_type = LYD_ANYDATA_LYB;
+    } else {
+        value_type = anydata->value_type;
+    }
+
+    /* write necessary basic data */
+    LY_CHECK_RET(lyb_print_node_header(out, (struct lyd_node *)anydata, lyd_lybctx));
+
+    /* first byte is type */
+    LY_CHECK_GOTO(ret = lyb_write_number(value_type, sizeof value_type, out, lybctx), cleanup);
+
+    if (anydata->value_type == LYD_ANYDATA_DATATREE) {
+        /* print LYB data tree to memory */
+        LY_CHECK_GOTO(ret = ly_out_new_memory(&buf, 0, &out2), cleanup);
+        LY_CHECK_GOTO(ret = lyb_print_data(out2, anydata->value.tree, LYD_PRINT_WITHSIBLINGS), cleanup);
+
+        len = lyd_lyb_data_length(buf);
+        assert(len != -1);
+        str = buf;
+    } else if (anydata->value_type == LYD_ANYDATA_LYB) {
+        len = lyd_lyb_data_length(anydata->value.mem);
+        assert(len != -1);
+        str = anydata->value.mem;
+    } else {
+        len = strlen(anydata->value.str);
+        str = anydata->value.str;
+    }
+
+    /* followed by the content */
+    LY_CHECK_GOTO(ret = lyb_write_string(str, (size_t)len, 1, out, lybctx), cleanup);
+
+cleanup:
+    ly_out_free(out2, NULL, 1);
+    return ret;
+}
+
+/**
  * @brief Print leaf node.
  *
  * @param[in] out Out structure.