Optimized search performance for large lists by sorting and binary search

This commit is contained in:
Olof hagsand 2017-12-27 11:34:47 +01:00
parent b743b0a080
commit 4b92dbdc10
28 changed files with 1405 additions and 701 deletions

View file

@ -547,7 +547,6 @@ yang2cli_list(clicon_handle h,
{
yang_stmt *yc;
yang_stmt *yd;
yang_stmt *ykey;
yang_stmt *yleaf;
int i;
cg_var *cvi;
@ -568,13 +567,7 @@ yang2cli_list(clicon_handle h,
cprintf(cbuf, "(\"%s\")", helptext);
}
/* Loop over all key variables */
if ((ykey = yang_find((yang_node*)ys, Y_KEY, NULL)) == NULL){
clicon_err(OE_XML, 0, "List statement \"%s\" has no key", ys->ys_argument);
goto done;
}
/* The value is a list of keys: <key>[ <key>]* */
if ((cvk = yang_arg2cvec(ykey, " ")) == NULL)
goto done;
cvk = ys->ys_cvec; /* Use Y_LIST cache, see ys_populate_list() */
cvi = NULL;
/* Iterate over individual keys */
while ((cvi = cvec_each(cvk, cvi)) != NULL) {
@ -614,8 +607,6 @@ yang2cli_list(clicon_handle h,
done:
if (helptext)
free(helptext);
if (cvk)
cvec_free(cvk);
return retval;
}