* Optimizations

* Reduced memory for attribute and body objects, see `XML_NEW_DIFFERENTIATE` compile-time option.
  * Optimized cbuf handling in parsing and xml2cbuf functions.
  * Optimized xml scanner to read strings rather than single chars
  * Optimized xml_merge for the case of disjunct trees.
This commit is contained in:
Olof hagsand 2020-04-28 22:31:58 +02:00
parent 9a8c6cf3e6
commit 94cf4a88b3
24 changed files with 477 additions and 257 deletions

View file

@ -407,6 +407,30 @@ xml_sort(cxobj *x,
return 0;
}
/*! Recursively sort a tree
* Alt to use xml_apply
*/
int
xml_sort_recurse(cxobj *xn)
{
int retval = -1;
cxobj *x;
int ret;
x = NULL;
while ((x = xml_child_each(xn, x, CX_ELMNT)) != NULL) {
if ((ret = xml_sort(x, NULL)) < 0)
goto done;
if (ret == 1) /* This node is not sortable */
break;
if (xml_sort_recurse(x) < 0)
goto done;
}
retval = 0;
done:
return retval;
}
/*! Special case search for ordered-by user or state data where linear sort is used
*
* @param[in] xp Parent XML node (go through its childre)