sr_val_t *val = NULL;
char *json_str = NULL;
struct lyd_node *root = NULL;
+ struct lyd_node *node = NULL;
rc = sr_get_changes_iter(session, "//." , &it);
if (rc != SR_ERR_OK) {
val = oper == SR_OP_CREATED ? new_value : old_value;
char *leaf = sr_val_to_str(val);
if (root) {
- lyd_new_path(root, NULL, val->xpath, (void *) leaf, 0, 1);
+ lyd_new_path(root, NULL, val->xpath, (void *) leaf, LYD_NEW_PATH_UPDATE, &node);
} else {
- root = lyd_new_path(NULL, sr_get_context(sr_session_get_connection(session)), val->xpath, (void *) leaf, 0, 1);
+ lyd_new_path(NULL, sr_get_context(sr_session_get_connection(session)), val->xpath, (void *) leaf, LYD_NEW_PATH_UPDATE, &root);
}
sr_free_val(old_value);
}
if (root) {
- lyd_print_mem(&json_str, root, LYD_JSON, LYP_WITHSIBLINGS | LYP_FORMAT);
+ lyd_print_mem(&json_str, root, LYD_JSON, LYD_PRINT_WITHSIBLINGS);
printf("\n%s\n", json_str);
}
}
if (data) {
- lyd_print_mem(&json_str, data, LYD_JSON, LYP_WITHSIBLINGS | LYP_FORMAT);
+ lyd_print_mem(&json_str, data, LYD_JSON, LYD_PRINT_WITHSIBLINGS);
}
return json_str;
}
void create_new_path(sr_session_ctx_t *session, char **parent, char *key, char *value) {
struct lyd_node **p = (struct lyd_node **)parent;
+ struct lyd_node *node;
if (*parent == NULL) {
- *p = lyd_new_path(NULL, sr_get_context(sr_session_get_connection(session)), key, value, 0, 0);
+ lyd_new_path(NULL, sr_get_context(sr_session_get_connection(session)), key, value, LYD_NEW_PATH_UPDATE, &node);
} else {
- lyd_new_path(*p, sr_get_context(sr_session_get_connection(session)), key, value, 0, 0);
+ lyd_new_path(*p, sr_get_context(sr_session_get_connection(session)), key, value, LYD_NEW_PATH_UPDATE, &node);
}
-}
\ No newline at end of file
+}