* C-API: Added xpath_first_localonly() as an xpath function that skips prefix and namespace checks.

* Added experimental code for optizing XPath search using binary search.
  * Enable with XPATH_LIST_OPTIMIZE
* Changed `clicon_rpc_generate_error(msg, xerr)` to `clicon_rpc_generate_error(xerr, msg, arg)`
This commit is contained in:
Olof hagsand 2019-12-20 18:21:46 +01:00
parent ab46ce9820
commit 7ad16bd84b
56 changed files with 602 additions and 227 deletions

View file

@ -58,7 +58,6 @@
#include <sys/param.h>
#include <sys/mount.h>
#include <pwd.h>
#include <assert.h>
/* cligen */
#include <cligen/cligen.h>
@ -70,7 +69,6 @@
#include "cli_common.h"
/*! Register log notification stream
* @param[in] h Clicon handle
* @param[in] stream Event stream. CLICON is predefined, others are application-defined
@ -715,13 +713,13 @@ compare_dbs(clicon_handle h,
if (clicon_rpc_get_config(h, NULL, "running", "/", NULL, &xc1) < 0)
goto done;
if ((xerr = xpath_first(xc1, NULL, "/rpc-error")) != NULL){
clicon_rpc_generate_error("Get configuration", xerr);
clicon_rpc_generate_error(xerr, "Get configuration", NULL);
goto done;
}
if (clicon_rpc_get_config(h, NULL, "candidate", "/", NULL, &xc2) < 0)
goto done;
if ((xerr = xpath_first(xc2, NULL, "/rpc-error")) != NULL){
clicon_rpc_generate_error("Get configuration", xerr);
clicon_rpc_generate_error(xerr, "Get configuration", NULL);
goto done;
}
if (compare_xmls(xc1, xc2, astext) < 0) /* astext? */
@ -885,7 +883,7 @@ save_config_file(clicon_handle h,
goto done;
}
if ((xerr = xpath_first(xt, NULL, "/rpc-error")) != NULL){
clicon_rpc_generate_error("Get configuration", xerr);
clicon_rpc_generate_error(xerr, "Get configuration", NULL);
goto done;
}
/* get-config returns a <data> tree. Save as <config> tree so it can be used
@ -1225,7 +1223,7 @@ cli_copy_config(clicon_handle h,
if (clicon_rpc_get_config(h, NULL, db, cbuf_get(cb), nsc, &x1) < 0)
goto done;
if ((xerr = xpath_first(x1, NULL, "/rpc-error")) != NULL){
clicon_rpc_generate_error("Get configuration", xerr);
clicon_rpc_generate_error(xerr, "Get configuration", NULL);
goto done;
}