Fixed: [Problem deleting non-last list element if ordered-by user](https://github.com/clicon/clixon/issues/475)

This commit is contained in:
Olof hagsand 2024-01-07 16:45:28 +01:00
parent cb3e74971d
commit 04a548ad78
6 changed files with 389 additions and 25 deletions

View file

@ -1011,21 +1011,8 @@ xml_insert2(cxobj *xp,
}
xc = xml_child_i(xp, mid);
if ((yc = xml_spec(xc)) == NULL){
#if 1
/* These are eg attributes, like a NETCONF message */
cmp = 1;
#else
/* Strict checks for config, but one may want to merge XMLs with attributes as well,
such as NETCONF messages */
if (xml_type(xc) == CX_ATTR)
clixon_err(OE_XML, 0, "Internal sort error: Unexpected attribute: \"%s:%s\"",
xml_prefix(xc), xml_name(xc));
else if (xml_type(xc) == CX_ELMNT)
clixon_err(OE_XML, 0, "Internal sort error, \"%s:%s\": unexpected node type: %s",
xml_prefix(xc), xml_name(xc), xml_type2str(xml_type(xc)));
else
clixon_err(OE_XML, 0, "Internal sort error, \"%s:%s\": No yang spec found", xml_prefix(xc), xml_name(xc));
goto done;
#endif
}
if (yc == yn){ /* Same yang */
if (userorder){ /* append: increment linearly until no longer equal */