libyang BUGFIX do not overwrite temp log opts
diff --git a/src/plugins_exts/schema_mount.c b/src/plugins_exts/schema_mount.c
index cc63431..352b29d 100644
--- a/src/plugins_exts/schema_mount.c
+++ b/src/plugins_exts/schema_mount.c
@@ -903,7 +903,7 @@
enum lyd_type data_type, uint32_t val_opts, struct lyd_node **diff)
{
LY_ERR ret = LY_SUCCESS;
- uint32_t temp_lo = LY_LOSTORE_LAST, i;
+ uint32_t *prev_lo, temp_lo = LY_LOSTORE_LAST, i;
struct ly_err_item *err;
struct lyd_node *iter, *ext_data = NULL, *ref_first = NULL, *orig_parent = lyd_parent(sibling), *op_tree;
struct lyd_node *ext_diff = NULL, *diff_parent = NULL;
@@ -951,7 +951,7 @@
}
/* only store messages in the context, log as an extension */
- ly_temp_log_options(&temp_lo);
+ prev_lo = ly_temp_log_options(&temp_lo);
if (data_type == LYD_TYPE_DATA_YANG) {
/* validate all the modules with data */
@@ -962,7 +962,7 @@
}
/* restore logging */
- ly_temp_log_options(NULL);
+ ly_temp_log_options(prev_lo);
/* restore sibling tree */
for (i = 0; i < ref_set->count; ++i) {
diff --git a/src/plugins_types/instanceid_keys.c b/src/plugins_types/instanceid_keys.c
index ab7751c..13f51c8 100644
--- a/src/plugins_types/instanceid_keys.c
+++ b/src/plugins_types/instanceid_keys.c
@@ -139,7 +139,7 @@
LY_ERR ret = LY_SUCCESS;
struct lysc_type_str *type_str = (struct lysc_type_str *)type;
struct lyd_value_instance_identifier_keys *val;
- uint32_t log_opts = LY_LOSTORE;
+ uint32_t *prev_lo, temp_lo = LY_LOSTORE;
char *canon;
/* init storage */
@@ -171,10 +171,10 @@
}
/* do not log */
- ly_temp_log_options(&log_opts);
+ prev_lo = ly_temp_log_options(&temp_lo);
ret = ly_path_parse_predicate(ctx, NULL, value_len ? value : "", value_len, LY_PATH_PREFIX_OPTIONAL,
LY_PATH_PRED_KEYS, &val->keys);
- ly_temp_log_options(NULL);
+ ly_temp_log_options(prev_lo);
if (ret) {
ret = ly_err_new(err, ret, LYVE_DATA, NULL, NULL, "%s", ly_errmsg(ctx));
ly_err_clean((struct ly_ctx *)ctx, NULL);
diff --git a/src/plugins_types/union.c b/src/plugins_types/union.c
index a5b7610..03571b0 100644
--- a/src/plugins_types/union.c
+++ b/src/plugins_types/union.c
@@ -223,7 +223,7 @@
LY_ERR ret = LY_SUCCESS;
LY_ARRAY_COUNT_TYPE u;
struct ly_err_item **errs = NULL, *e;
- uint32_t temp_lo = 0;
+ uint32_t *prev_lo, temp_lo = 0;
char *msg = NULL;
int msg_len = 0;
@@ -238,7 +238,7 @@
LY_CHECK_RET(!errs, LY_EMEM);
/* turn logging temporarily off */
- ly_temp_log_options(&temp_lo);
+ prev_lo = ly_temp_log_options(&temp_lo);
/* use the first usable subtype to store the value */
for (u = 0; u < LY_ARRAY_COUNT(types); ++u) {
@@ -279,7 +279,7 @@
}
free(errs);
free(msg);
- ly_temp_log_options(NULL);
+ ly_temp_log_options(prev_lo);
return ret;
}
diff --git a/src/printer_json.c b/src/printer_json.c
index c94a765..5b762dd 100644
--- a/src/printer_json.c
+++ b/src/printer_json.c
@@ -548,7 +548,7 @@
LY_ERR ret = LY_SUCCESS;
struct lyd_node *iter;
const struct lyd_node *prev_parent;
- uint32_t prev_opts, temp_lo = 0;
+ uint32_t prev_opts, *prev_lo, temp_lo = 0;
assert(any->schema->nodetype & LYD_NODE_ANY);
@@ -560,7 +560,7 @@
uint32_t parser_options = LYD_PARSE_ONLY | LYD_PARSE_OPAQ | LYD_PARSE_STRICT;
/* turn logging off */
- ly_temp_log_options(&temp_lo);
+ prev_lo = ly_temp_log_options(&temp_lo);
/* try to parse it into a data tree */
if (lyd_parse_data_mem(pctx->ctx, any->value.mem, LYD_LYB, parser_options, 0, &iter) == LY_SUCCESS) {
@@ -571,7 +571,7 @@
}
/* turn logging on again */
- ly_temp_log_options(NULL);
+ ly_temp_log_options(prev_lo);
}
switch (any->value_type) {
diff --git a/src/printer_xml.c b/src/printer_xml.c
index 9cd6774..217f8cb 100644
--- a/src/printer_xml.c
+++ b/src/printer_xml.c
@@ -410,7 +410,7 @@
{
struct lyd_node_any *any = (struct lyd_node_any *)node;
struct lyd_node *iter;
- uint32_t prev_opts, temp_lo = 0;
+ uint32_t prev_opts, *prev_lo, temp_lo = 0;
LY_ERR ret;
if ((node->schema->nodetype == LYS_ANYDATA) && (node->value_type != LYD_ANYDATA_DATATREE)) {
@@ -427,7 +427,7 @@
} else {
if (any->value_type == LYD_ANYDATA_LYB) {
/* turn logging off */
- ly_temp_log_options(&temp_lo);
+ prev_lo = ly_temp_log_options(&temp_lo);
/* try to parse it into a data tree */
if (lyd_parse_data_mem((struct ly_ctx *)LYD_CTX(node), any->value.mem, LYD_LYB,
@@ -439,7 +439,7 @@
}
/* turn logging on again */
- ly_temp_log_options(NULL);
+ ly_temp_log_options(prev_lo);
}
switch (any->value_type) {
diff --git a/src/tree_data_new.c b/src/tree_data_new.c
index e56e61e..e7f5f61 100644
--- a/src/tree_data_new.c
+++ b/src/tree_data_new.c
@@ -263,7 +263,7 @@
{
LY_ERR rc = LY_SUCCESS;
struct lyd_ctx *lydctx = NULL;
- uint32_t parse_opts, int_opts, log_opts = 0;
+ uint32_t parse_opts, int_opts, *prev_lo, temp_lo = 0;
*tree = NULL;
@@ -273,7 +273,7 @@
if (!log) {
/* no logging */
- ly_temp_log_options(&log_opts);
+ prev_lo = ly_temp_log_options(&temp_lo);
}
switch (value_type) {
@@ -297,7 +297,7 @@
if (!log) {
/* restore logging */
- ly_temp_log_options(NULL);
+ ly_temp_log_options(prev_lo);
}
if (rc && *tree) {
lyd_free_siblings(*tree);
diff --git a/src/tree_schema.c b/src/tree_schema.c
index d284a83..df89924 100644
--- a/src/tree_schema.c
+++ b/src/tree_schema.c
@@ -1090,7 +1090,7 @@
void
lys_unres_glob_revert(struct ly_ctx *ctx, struct lys_glob_unres *unres)
{
- uint32_t i, j, idx, temp_lo = 0;
+ uint32_t i, j, idx, *prev_lo, temp_lo = 0;
struct lysf_ctx fctx = {.ctx = ctx};
struct ly_set *dep_set;
LY_ERR ret;
@@ -1134,9 +1134,9 @@
if (unres->implementing.count) {
/* recompile previous context because some implemented modules are no longer implemented,
* we can reuse the current to_compile flags */
- ly_temp_log_options(&temp_lo);
+ prev_lo = ly_temp_log_options(&temp_lo);
ret = lys_compile_depset_all(ctx, &ctx->unres);
- ly_temp_log_options(NULL);
+ ly_temp_log_options(prev_lo);
if (ret) {
LOGINT(ctx);
}
diff --git a/src/xpath.c b/src/xpath.c
index 379e104..139cd0f 100644
--- a/src/xpath.c
+++ b/src/xpath.c
@@ -7799,7 +7799,7 @@
const struct lyxp_set *set, struct ly_path_predicate **predicates)
{
LY_ERR rc = LY_SUCCESS;
- uint32_t e_idx, val_start_idx, pred_idx = 0, temp_lo = 0, pred_len = 0, nested_pred;
+ uint32_t e_idx, val_start_idx, pred_idx = 0, *prev_lo, temp_lo = 0, pred_len = 0, nested_pred;
const struct lysc_node *key;
char *pred = NULL;
struct lyxp_expr *exp2 = NULL;
@@ -7807,7 +7807,7 @@
assert(ctx_scnode->nodetype & (LYS_LIST | LYS_LEAFLIST));
/* turn logging off */
- ly_temp_log_options(&temp_lo);
+ prev_lo = ly_temp_log_options(&temp_lo);
if (ctx_scnode->nodetype == LYS_LIST) {
/* check for predicates "[key1=...][key2=...]..." */
@@ -7942,7 +7942,7 @@
*tok_idx = e_idx;
cleanup:
- ly_temp_log_options(NULL);
+ ly_temp_log_options(prev_lo);
lyxp_expr_free(set->ctx, exp2);
free(pred);
return rc;