* 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:
parent
3cd3f7987d
commit
392e6679c5
17 changed files with 166 additions and 89 deletions
|
|
@ -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);
|
||||
|
|
|
|||
|
|
@ -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++;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -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]);
|
||||
|
|
|
|||
|
|
@ -287,6 +287,7 @@ restconf_convert_hdr(clicon_handle h,
|
|||
cbuf *cb = NULL;
|
||||
int i;
|
||||
char c;
|
||||
size_t len;
|
||||
|
||||
if ((cb = cbuf_new()) == NULL){
|
||||
clicon_err(OE_UNIX, errno, "cbuf_new");
|
||||
|
|
@ -294,7 +295,8 @@ restconf_convert_hdr(clicon_handle h,
|
|||
}
|
||||
/* convert key name */
|
||||
cprintf(cb, "HTTP_");
|
||||
for (i=0; i<strlen(name); i++){
|
||||
len = strlen(name);
|
||||
for (i=0; i<len; i++){
|
||||
c = name[i] & 0xff;
|
||||
if (islower(c))
|
||||
cprintf(cb, "%c", toupper(c));
|
||||
|
|
|
|||
|
|
@ -113,6 +113,7 @@ yang_patch_xml2json_modified_cbuf(cxobj *x_simple_patch)
|
|||
cbuf *cb = NULL;
|
||||
char *json_simple_patch_tmp;
|
||||
int brace_count = 0;
|
||||
size_t len;
|
||||
|
||||
json_simple_patch = cbuf_new();
|
||||
if (json_simple_patch == NULL)
|
||||
|
|
@ -122,7 +123,8 @@ yang_patch_xml2json_modified_cbuf(cxobj *x_simple_patch)
|
|||
|
||||
// Insert a '[' after the first '{' to get the JSON to match what api_data_post/write() expect
|
||||
json_simple_patch_tmp = cbuf_get(cb);
|
||||
for (int l = 0; l < strlen(json_simple_patch_tmp); l++) {
|
||||
len = strlen(json_simple_patch_tmp);
|
||||
for (int l = 0; l < strlen(len); l++) {
|
||||
char c = json_simple_patch_tmp[l];
|
||||
if (c == '{') {
|
||||
brace_count++;
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue