printers REFACTOR remove redundant parameters
diff --git a/src/printer_internal.h b/src/printer_internal.h
index 05f2dc7..838ca54 100644
--- a/src/printer_internal.h
+++ b/src/printer_internal.h
@@ -26,12 +26,11 @@
* @brief YANG printer of the parsed module. Full YANG printer.
*
* @param[in] out Output specification.
- * @param[in] module Main module.
* @param[in] modp Parsed module to print.
* @param[in] options Schema output options (see @ref schemaprinterflags).
* @return LY_ERR value, number of the printed bytes is updated in ::ly_out.printed.
*/
-LY_ERR yang_print_parsed_module(struct ly_out *out, const struct lys_module *module, const struct lysp_module *modp, uint32_t options);
+LY_ERR yang_print_parsed_module(struct ly_out *out, const struct lysp_module *modp, uint32_t options);
/**
* @brief Helper macros for data printers
@@ -48,13 +47,11 @@
* @brief YANG printer of the parsed submodule. Full YANG printer.
*
* @param[in] out Output specification.
- * @param[in] module Main module.
* @param[in] submodp Parsed submodule to print.
* @param[in] options Schema output options (see @ref schemaprinterflags).
* @return LY_ERR value, number of the printed bytes is updated in ::ly_out.printed.
*/
-LY_ERR yang_print_parsed_submodule(struct ly_out *out, const struct lys_module *module,
- const struct lysp_submodule *submodp, uint32_t options);
+LY_ERR yang_print_parsed_submodule(struct ly_out *out, const struct lysp_submodule *submodp, uint32_t options);
/**
* @brief YANG printer of the compiled schemas.
@@ -88,25 +85,21 @@
* @brief YIN printer of the parsed module. Full YIN printer.
*
* @param[in] out Output specification.
- * @param[in] module Main module.
* @param[in] modp Parsed module to print.
* @param[in] options Schema output options (see @ref schemaprinterflags).
* @return LY_ERR value, number of the printed bytes is updated in ::ly_out.printed.
*/
-LY_ERR yin_print_parsed_module(struct ly_out *out, const struct lys_module *module, const struct lysp_module *modp,
- uint32_t options);
+LY_ERR yin_print_parsed_module(struct ly_out *out, const struct lysp_module *modp, uint32_t options);
/**
* @brief YIN printer of the parsed submodule. Full YIN printer.
*
* @param[in] out Output specification.
- * @param[in] module Main module.
* @param[in] submodp Parsed submodule to print.
* @param[in] options Schema output options (see @ref schemaprinterflags).
* @return LY_ERR value, number of the printed bytes is updated in ::ly_out.printed.
*/
-LY_ERR yin_print_parsed_submodule(struct ly_out *out, const struct lys_module *module,
- const struct lysp_submodule *submodp, uint32_t options);
+LY_ERR yin_print_parsed_submodule(struct ly_out *out, const struct lysp_submodule *submodp, uint32_t options);
/**
* @brief YANG Tree Diagram printer of the parsed submodule. Full YANG Tree printer.
diff --git a/src/printer_schema.c b/src/printer_schema.c
index a376c14..4cb89a0 100644
--- a/src/printer_schema.c
+++ b/src/printer_schema.c
@@ -42,7 +42,7 @@
break;
}
- ret = yang_print_parsed_module(out, module, module->parsed, options);
+ ret = yang_print_parsed_module(out, module->parsed, options);
break;
case LYS_OUT_YANG_COMPILED:
if (!module->compiled) {
@@ -60,7 +60,7 @@
break;
}
- ret = yin_print_parsed_module(out, module, module->parsed, options);
+ ret = yin_print_parsed_module(out, module->parsed, options);
break;
case LYS_OUT_TREE:
if (!module->parsed) {
@@ -85,33 +85,33 @@
}
API LY_ERR
-lys_print_submodule(struct ly_out *out, const struct lys_module *module, const struct lysp_submodule *submodule,
- LYS_OUTFORMAT format, size_t UNUSED(line_length), uint32_t options)
+lys_print_submodule(struct ly_out *out, const struct lysp_submodule *submodule, LYS_OUTFORMAT format,
+ size_t UNUSED(line_length), uint32_t options)
{
LY_ERR ret;
- LY_CHECK_ARG_RET(NULL, out, module, submodule, LY_EINVAL);
+ LY_CHECK_ARG_RET(NULL, out, submodule, LY_EINVAL);
/* reset number of printed bytes */
out->func_printed = 0;
switch (format) {
case LYS_OUT_YANG:
- ret = yang_print_parsed_submodule(out, module, submodule, options);
+ ret = yang_print_parsed_submodule(out, submodule, options);
break;
case LYS_OUT_YIN:
- ret = yin_print_parsed_submodule(out, module, submodule, options);
+ ret = yin_print_parsed_submodule(out, submodule, options);
break;
/* TODO not yet implemented
case LYS_OUT_TREE:
- ret = tree_print_submodule(out, module, submodule, options, line_length);
+ ret = tree_print_submodule(out, submodule, options, line_length);
break;
case LYS_OUT_INFO:
ret = info_print_model(out, module, target_node);
break;
*/
default:
- LOGERR(module->ctx, LY_EINVAL, "Unsupported output format.");
+ LOGERR(submodule->mod->ctx, LY_EINVAL, "Unsupported output format.");
ret = LY_EINVAL;
break;
}
diff --git a/src/printer_schema.h b/src/printer_schema.h
index a204f8a..7306272 100644
--- a/src/printer_schema.h
+++ b/src/printer_schema.h
@@ -123,21 +123,21 @@
* @param[in] options Schema output options (see @ref schemaprinterflags).
* @return LY_ERR value.
*/
-LY_ERR lys_print_module(struct ly_out *out, const struct lys_module *module, LYS_OUTFORMAT format, size_t line_length, uint32_t options);
+LY_ERR lys_print_module(struct ly_out *out, const struct lys_module *module, LYS_OUTFORMAT format, size_t line_length,
+ uint32_t options);
/**
* @brief Schema submodule printer.
*
* @param[in] out Printer handler for a specific output. Use ly_out_*() functions to create and free the handler.
- * @param[in] module Main module of the submodule to print.
* @param[in] submodule Parsed submodule to print.
* @param[in] format Output format (LYS_OUT_YANG_COMPILED is not supported).
* @param[in] line_length Maximum characters to be printed on a line, 0 for unlimited. Only for #LYS_OUT_TREE printer.
* @param[in] options Schema output options (see @ref schemaprinterflags).
* @return LY_ERR value.
*/
-LY_ERR lys_print_submodule(struct ly_out *out, const struct lys_module *module, const struct lysp_submodule *submodule,
- LYS_OUTFORMAT format, size_t line_length, uint32_t options);
+LY_ERR lys_print_submodule(struct ly_out *out, const struct lysp_submodule *submodule, LYS_OUTFORMAT format,
+ size_t line_length, uint32_t options);
/**
* @brief Print schema tree in the specified format into a memory block.
diff --git a/src/printer_yang.c b/src/printer_yang.c
index f41ad9a..3b94bcd 100644
--- a/src/printer_yang.c
+++ b/src/printer_yang.c
@@ -2144,9 +2144,10 @@
}
LY_ERR
-yang_print_parsed_module(struct ly_out *out, const struct lys_module *module, const struct lysp_module *modp, uint32_t options)
+yang_print_parsed_module(struct ly_out *out, const struct lysp_module *modp, uint32_t options)
{
LY_ARRAY_COUNT_TYPE u;
+ const struct lys_module *module = modp->mod;
struct ypr_ctx ctx_ = {.out = out, .level = 0, .module = module, .schema = YPR_PARSED, .options = options}, *ctx = &ctx_;
ly_print_(ctx->out, "%*smodule %s {\n", INDENT, module->name);
@@ -2201,10 +2202,11 @@
}
LY_ERR
-yang_print_parsed_submodule(struct ly_out *out, const struct lys_module *module, const struct lysp_submodule *submodp, uint32_t options)
+yang_print_parsed_submodule(struct ly_out *out, const struct lysp_submodule *submodp, uint32_t options)
{
LY_ARRAY_COUNT_TYPE u;
- struct ypr_ctx ctx_ = {.out = out, .level = 0, .module = module, .schema = YPR_PARSED, .options = options}, *ctx = &ctx_;
+ struct ypr_ctx ctx_ = {.out = out, .level = 0, .module = submodp->mod, .schema = YPR_PARSED,
+ .options = options}, *ctx = &ctx_;
ly_print_(ctx->out, "%*ssubmodule %s {\n", INDENT, submodp->name);
LEVEL++;
diff --git a/src/printer_yin.c b/src/printer_yin.c
index c0bc7ac..95dfa77 100644
--- a/src/printer_yin.c
+++ b/src/printer_yin.c
@@ -1410,9 +1410,10 @@
}
LY_ERR
-yin_print_parsed_module(struct ly_out *out, const struct lys_module *module, const struct lysp_module *modp, uint32_t options)
+yin_print_parsed_module(struct ly_out *out, const struct lysp_module *modp, uint32_t options)
{
LY_ARRAY_COUNT_TYPE u;
+ const struct lys_module *module = modp->mod;
struct ypr_ctx ctx_ = {.out = out, .level = 0, .module = module, .options = options}, *ctx = &ctx_;
ly_print_(ctx->out, "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n");
@@ -1472,14 +1473,14 @@
}
LY_ERR
-yin_print_parsed_submodule(struct ly_out *out, const struct lys_module *module, const struct lysp_submodule *submodp, uint32_t options)
+yin_print_parsed_submodule(struct ly_out *out, const struct lysp_submodule *submodp, uint32_t options)
{
LY_ARRAY_COUNT_TYPE u;
- struct ypr_ctx ctx_ = {.out = out, .level = 0, .module = module, .options = options}, *ctx = &ctx_;
+ struct ypr_ctx ctx_ = {.out = out, .level = 0, .module = submodp->mod, .options = options}, *ctx = &ctx_;
ly_print_(ctx->out, "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n");
ly_print_(ctx->out, "%*s<submodule name=\"%s\"\n", INDENT, submodp->name);
- ypr_xmlns(ctx, module, XML_NS_INDENT);
+ ypr_xmlns(ctx, submodp->mod, XML_NS_INDENT);
ypr_import_xmlns(ctx, (struct lysp_module *)submodp, XML_NS_INDENT);
ly_print_(ctx->out, ">\n");