Skip to content

Commit

Permalink
Revert premature default optimize fix
Browse files Browse the repository at this point in the history
  • Loading branch information
olofhagsand committed Jan 9, 2024
1 parent 7b5dc3d commit 907da6a
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 8 deletions.
2 changes: 0 additions & 2 deletions lib/src/clixon_datastore_read.c
Original file line number Diff line number Diff line change
Expand Up @@ -1003,10 +1003,8 @@ xmldb_get_cache(clixon_handle h,
goto done;
}
/* Original tree: Remove global defaults and empty non-presence containers */
#if 0
if (xml_defaults_nopresence(x0t, 2) < 0)
goto done;
#endif
switch (wdef){
case WITHDEFAULTS_REPORT_ALL:
break;
Expand Down
14 changes: 8 additions & 6 deletions lib/src/clixon_datastore_write.c
Original file line number Diff line number Diff line change
Expand Up @@ -582,14 +582,17 @@ text_modify(clixon_handle h,
x1bstr = xml_body(x1);
switch(op){
case OP_CREATE:
if (x0){
if (x0 && xml_flag(x0, XML_FLAG_DEFAULT)==0){
if (netconf_data_exists(cbret, "Data already exists; cannot create new resource") < 0)
goto done;
goto fail;
}
case OP_REPLACE: /* fall thru */
case OP_MERGE:
if (!(op == OP_MERGE && instr==NULL)){
/* If default flag, clear it */
if (x0 && xml_flag(x0, XML_FLAG_DEFAULT))
xml_flag_reset(x0, XML_FLAG_DEFAULT);
if (!(op == OP_MERGE && (instr==NULL))) {
/* Remove existing, also applies to merge in the special case
* of ordered-by user and (changed) insert attribute.
*/
Expand Down Expand Up @@ -710,7 +713,7 @@ text_modify(clixon_handle h,
}
break;
case OP_DELETE:
if (x0==NULL){
if (x0==NULL || xml_flag(x0, XML_FLAG_DEFAULT) != 0){
if (netconf_data_missing(cbret, "Data does not exist; cannot delete resource") < 0)
goto done;
goto fail;
Expand Down Expand Up @@ -780,7 +783,7 @@ text_modify(clixon_handle h,
}
switch(op){
case OP_CREATE:
if (x0){
if (x0 && xml_flag(x0, XML_FLAG_DEFAULT)==0){
if (xml_defaults_nopresence(x0, 0) == 0){
if (netconf_data_exists(cbret, "Data already exists; cannot create new resource") < 0)
goto done;
Expand Down Expand Up @@ -973,7 +976,7 @@ text_modify(clixon_handle h,
}
break;
case OP_DELETE:
if (x0==NULL){
if (x0==NULL || xml_flag(x0, XML_FLAG_DEFAULT) != 0){
if (netconf_data_missing(cbret, "Data does not exist; cannot delete resource") < 0)
goto done;
goto fail;
Expand Down Expand Up @@ -1304,7 +1307,6 @@ xmldb_put(clixon_handle h,
}
goto fail;
}

/* Remove NONE nodes if all subs recursively are also NONE */
if (xml_tree_prune_flagged_sub(x0, XML_FLAG_NONE, 0, NULL) <0)
goto done;
Expand Down

0 comments on commit 907da6a

Please sign in to comment.