* JSON errors are now labelled with JSON and not XML

* Fixed: [Performance issue when parsing large JSON param](https://github.com/clicon/clixon/issues/266)
* Moved strlen() from for end condition
* Fixed debugging of xpath parser
This commit is contained in:
Olof hagsand 2021-09-20 20:30:56 +02:00
parent 3cd3f7987d
commit 392e6679c5
17 changed files with 166 additions and 89 deletions

View file

@ -521,6 +521,7 @@ cli_auto_up(clicon_handle h,
char *api_path = NULL;
int i;
int j;
size_t len;
if (cvec_len(argv) != 1){
clicon_err(OE_PLUGIN, EINVAL, "Usage: %s(<treename>)", __FUNCTION__);
@ -551,7 +552,8 @@ cli_auto_up(clicon_handle h,
/* Find diff of 0 and 1 (how many variables differ?) and trunc cvv0 by that amount */
cvv0 = clicon_data_cvec_get(h, "cli-edit-cvv");
j=0; /* count diffs */
for (i=strlen(api_path_fmt1); i<strlen(api_path_fmt0); i++)
len = strlen(api_path_fmt0);
for (i=strlen(api_path_fmt1); i<len; i++)
if (api_path_fmt0[i] == '%')
j++;
cvv1 = cvec_new(0);

View file

@ -1210,6 +1210,7 @@ cli_copy_config(clicon_handle h,
char *toname;
cxobj *xerr;
cvec *nsc = NULL;
size_t len;
if (cvec_len(argv) != 6){
clicon_err(OE_PLUGIN, EINVAL, "Requires 6 elements: <db> <xpath> <namespace> <keyname> <from> <to>");
@ -1241,8 +1242,9 @@ cli_copy_config(clicon_handle h,
goto done;
}
/* Sanity check that xpath contains exactly two %s, ie [%s='%s'] */
len = strlen(xpath);
j = 0;
for (i=0; i<strlen(xpath); i++){
for (i=0; i<len; i++){
if (xpath[i] == '%')
j++;
}

View file

@ -404,6 +404,7 @@ yang2cli_var_sub(clicon_handle h,
int j;
char *cvtypestr;
char *arg;
size_t len;
if (cvtype == CGV_VOID){
retval = 0;
@ -428,7 +429,8 @@ yang2cli_var_sub(clicon_handle h,
cprintf(cb, "|");
/* Encode by escaping delimiters */
arg = yang_argument_get(yi);
for (j=0; j<strlen(arg); j++){
len = strlen(arg);
for (j=0; j<len; j++){
if (index(CLIGEN_DELIMITERS, arg[j]))
cprintf(cb, "\\");
cprintf(cb, "%c", arg[j]);