summaryrefslogtreecommitdiffstats
path: root/contrib/libucl/ucl_parser.c
diff options
context:
space:
mode:
authorVsevolod Stakhov <vsevolod@highsecure.ru>2015-10-19 18:53:39 +0100
committerVsevolod Stakhov <vsevolod@highsecure.ru>2015-10-19 18:53:39 +0100
commitd181d0c46e680e6952b1b8eabf31f798efc39065 (patch)
treefd51ab1b8f6da88a504cfd36297ffd51fbf997eb /contrib/libucl/ucl_parser.c
parentc754796783ff1214d9c19c59082f52d67125e51b (diff)
downloadrspamd-d181d0c46e680e6952b1b8eabf31f798efc39065.tar.gz
rspamd-d181d0c46e680e6952b1b8eabf31f798efc39065.zip
Merge from libucl.
Diffstat (limited to 'contrib/libucl/ucl_parser.c')
-rw-r--r--contrib/libucl/ucl_parser.c38
1 files changed, 27 insertions, 11 deletions
diff --git a/contrib/libucl/ucl_parser.c b/contrib/libucl/ucl_parser.c
index ae8b3c259..9bd41391b 100644
--- a/contrib/libucl/ucl_parser.c
+++ b/contrib/libucl/ucl_parser.c
@@ -2102,20 +2102,36 @@ ucl_state_machine (struct ucl_parser *parser)
*p != '(') {
ucl_chunk_skipc (chunk, p);
}
- else if (p - c > 0) {
- /* We got macro name */
- macro_len = (size_t)(p - c);
- HASH_FIND (hh, parser->macroes, c, macro_len, macro);
- if (macro == NULL) {
- ucl_create_err (&parser->err, "error on line %d at column %d: "
- "unknown macro: '%.*s', character: '%c'",
- chunk->line, chunk->column, (int)(p - c), c, *chunk->pos);
+ else {
+ if (p - c > 0) {
+ /* We got macro name */
+ macro_len = (size_t) (p - c);
+ HASH_FIND (hh, parser->macroes, c, macro_len, macro);
+ if (macro == NULL) {
+ ucl_create_err (&parser->err,
+ "error on line %d at column %d: "
+ "unknown macro: '%.*s', character: '%c'",
+ chunk->line,
+ chunk->column,
+ (int) (p - c),
+ c,
+ *chunk->pos);
+ parser->state = UCL_STATE_ERROR;
+ return false;
+ }
+ /* Now we need to skip all spaces */
+ SKIP_SPACES_COMMENTS(parser, chunk, p);
+ parser->state = UCL_STATE_MACRO;
+ }
+ else {
+ /* We have invalid macro name */
+ ucl_create_err (&parser->err,
+ "error on line %d at column %d: invalid macro name",
+ chunk->line,
+ chunk->column);
parser->state = UCL_STATE_ERROR;
return false;
}
- /* Now we need to skip all spaces */
- SKIP_SPACES_COMMENTS(parser, chunk, p);
- parser->state = UCL_STATE_MACRO;
}
break;
case UCL_STATE_MACRO: