added regexp free routines, replaced regexp mode string with symbol

This commit is contained in:
Olof Hagsand 2019-05-29 14:17:30 +00:00
parent 5706703ab4
commit 2ae9529a3e
10 changed files with 115 additions and 35 deletions

View file

@ -284,7 +284,7 @@ yang2cli_var_pattern(clicon_handle h,
cbuf *cb)
{
int retval = -1;
char *mode;
enum regexp_mode mode;
cg_var *cvp;
char *pattern;
int invert;
@ -295,7 +295,7 @@ yang2cli_var_pattern(clicon_handle h,
while ((cvp = cvec_each(patterns, cvp)) != NULL){
pattern = cv_string_get(cvp);
invert = cv_flag(cvp, V_INVERT);
if (strcmp(mode, "posix") == 0){
if (mode == REGEXP_POSIX){
posix = NULL;
if (regexp_xsd2posix(pattern, &posix) < 0)
goto done;

View file

@ -446,7 +446,7 @@ main(int argc, char **argv)
if (help)
usage(h, argv[0]);
if (strcmp(clicon_yang_regexp(h), "libxml2")==0){
if (clicon_yang_regexp(h) == REGEXP_LIBXML2){
#ifdef HAVE_LIBXML2
/* Enable XSD libxml2 regex engine */
cligen_regex_xsd_set(cli_cligen(h), 1);