From 456c2f66f3e06243835d9e62b8c289265e947e61 Mon Sep 17 00:00:00 2001 From: Vsevolod Stakhov Date: Sun, 19 Feb 2017 15:54:25 +0000 Subject: [PATCH] [Minor] Add ability to skip setting of file vars in UCL --- contrib/libucl/ucl.h | 3 ++- contrib/libucl/ucl_parser.c | 6 ++++-- 2 files changed, 6 insertions(+), 3 deletions(-) diff --git a/contrib/libucl/ucl.h b/contrib/libucl/ucl.h index ee683b163..ee03334e0 100644 --- a/contrib/libucl/ucl.h +++ b/contrib/libucl/ucl.h @@ -154,7 +154,8 @@ typedef enum ucl_parser_flags { UCL_PARSER_NO_TIME = (1 << 2), /**< Do not parse time and treat time values as strings */ UCL_PARSER_NO_IMPLICIT_ARRAYS = (1 << 3), /** Create explicit arrays instead of implicit ones */ UCL_PARSER_SAVE_COMMENTS = (1 << 4), /** Save comments in the parser context */ - UCL_PARSER_DISABLE_MACRO = (1 << 5) /** Treat macros as comments */ + UCL_PARSER_DISABLE_MACRO = (1 << 5), /** Treat macros as comments */ + UCL_PARSER_NO_FILEVARS = (1 << 6) /** Do not set file vars */ } ucl_parser_flags_t; /** diff --git a/contrib/libucl/ucl_parser.c b/contrib/libucl/ucl_parser.c index 82c4ca24b..d6b8eb656 100644 --- a/contrib/libucl/ucl_parser.c +++ b/contrib/libucl/ucl_parser.c @@ -2461,8 +2461,10 @@ ucl_parser_new (int flags) parser->comments = ucl_object_typed_new (UCL_OBJECT); } - /* Initial assumption about filevars */ - ucl_parser_set_filevars (parser, NULL, false); + if (!(flags & UCL_PARSER_NO_FILEVARS)) { + /* Initial assumption about filevars */ + ucl_parser_set_filevars (parser, NULL, false); + } return parser; } -- 2.39.5