diff options
author | Vsevolod Stakhov <vsevolod@highsecure.ru> | 2019-03-07 15:29:14 +0000 |
---|---|---|
committer | Vsevolod Stakhov <vsevolod@highsecure.ru> | 2019-03-07 15:29:14 +0000 |
commit | 813496dd02e73d00ca9936397c7a9bed5bcd61a3 (patch) | |
tree | 3114931545dc730b1b8787d9e983810db71772a4 /contrib/libucl/ucl_util.c | |
parent | 39ed10ed8fbc506845adb0b44b6ba40a8447b672 (diff) | |
download | rspamd-813496dd02e73d00ca9936397c7a9bed5bcd61a3.tar.gz rspamd-813496dd02e73d00ca9936397c7a9bed5bcd61a3.zip |
[Minor] Allow to set include trace function
Diffstat (limited to 'contrib/libucl/ucl_util.c')
-rw-r--r-- | contrib/libucl/ucl_util.c | 26 |
1 files changed, 26 insertions, 0 deletions
diff --git a/contrib/libucl/ucl_util.c b/contrib/libucl/ucl_util.c index 051ac2c27..fdd0862cc 100644 --- a/contrib/libucl/ucl_util.c +++ b/contrib/libucl/ucl_util.c @@ -1490,6 +1490,17 @@ ucl_include_common (const unsigned char *data, size_t len, params.strat = UCL_DUPLICATE_APPEND; params.must_exist = !default_try; + if (parser->include_trace_func) { + const ucl_object_t *parent = NULL; + + if (parser->stack) { + parent = parser->stack->obj; + } + + parser->include_trace_func (parser, parent, args, + data, len, parser->include_trace_ud); + } + /* Process arguments */ if (args != NULL && args->type == UCL_OBJECT) { while ((param = ucl_object_iterate (args, &it, true)) != NULL) { @@ -3840,3 +3851,18 @@ ucl_comments_add (ucl_object_t *comments, const ucl_object_t *obj, (const char *)&obj, sizeof (void *), true); } } + +void +ucl_parser_set_include_tracer (struct ucl_parser *parser, + ucl_include_trace_func_t func, + void *user_data) +{ + parser->include_trace_func = func; + parser->include_trace_ud = user_data; +} + +const char * +ucl_parser_get_cur_file (struct ucl_parser *parser) +{ + return parser->cur_file; +}
\ No newline at end of file |