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

@ -82,6 +82,14 @@ enum datastore_cache{
DATASTORE_CACHE_ZEROCOPY
};
/*! yang clixon regexp engine
* @see regexp_mode in clixon-config.yang
*/
enum regexp_mode{
REGEXP_POSIX,
REGEXP_LIBXML2
};
/*
* Prototypes
*/
@ -129,9 +137,6 @@ static inline char *clicon_yang_module_main(clicon_handle h){
static inline char *clicon_yang_module_revision(clicon_handle h){
return clicon_option_str(h, "CLICON_YANG_MODULE_REVISION");
}
static inline char *clicon_yang_regexp(clicon_handle h){
return clicon_option_str(h, "CLICON_YANG_REGEXP");
}
static inline char *clicon_backend_dir(clicon_handle h){
return clicon_option_str(h, "CLICON_BACKEND_DIR");
}
@ -176,7 +181,7 @@ int clicon_sock_port(clicon_handle h);
int clicon_autocommit(clicon_handle h);
int clicon_startup_mode(clicon_handle h);
enum datastore_cache clicon_datastore_cache(clicon_handle h);
enum regexp_mode clicon_yang_regexp(clicon_handle h);
/*-- Specific option access functions for non-yang options --*/
int clicon_quiet_mode(clicon_handle h);
int clicon_quiet_mode_set(clicon_handle h, int val);

View file

@ -42,5 +42,6 @@
int regexp_xsd2posix(char *xsd, char **posix);
int regex_compile(clicon_handle h, char *regexp, void **recomp);
int regex_exec(clicon_handle h, void *recomp, char *string);
int regex_free(clicon_handle h, void *recomp);
#endif /* _CLIXON_REGEX_H_ */

View file

@ -56,10 +56,12 @@ typedef struct yang_type_cache yang_type_cache;
*/
int yang_type_cache_set(yang_type_cache **ycache,
yang_stmt *resolved, int options,
cvec *cvv, cvec *patterns, cvec *regexps,
cvec *cvv, cvec *patterns,
int rxmode, cvec *regexps,
uint8_t fraction);
int yang_type_cache_get(yang_type_cache *ycache, yang_stmt **resolved,
int *options, cvec **cvv, cvec *patterns,
int *rxmode,
cvec *regexps, uint8_t *fraction);
int yang_type_cache_cp(yang_type_cache **ycnew, yang_type_cache *ycold);
int yang_type_cache_free(yang_type_cache *ycache);