aboutsummaryrefslogtreecommitdiffstats
path: root/contrib
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
parentc754796783ff1214d9c19c59082f52d67125e51b (diff)
downloadrspamd-d181d0c46e680e6952b1b8eabf31f798efc39065.tar.gz
rspamd-d181d0c46e680e6952b1b8eabf31f798efc39065.zip
Merge from libucl.
Diffstat (limited to 'contrib')
-rw-r--r--contrib/libucl/ucl.h2
-rw-r--r--contrib/libucl/ucl_chartable.h3
-rw-r--r--contrib/libucl/ucl_internal.h1
-rw-r--r--contrib/libucl/ucl_parser.c38
-rw-r--r--contrib/libucl/ucl_util.c2
5 files changed, 31 insertions, 15 deletions
diff --git a/contrib/libucl/ucl.h b/contrib/libucl/ucl.h
index bd209295b..82a1fd188 100644
--- a/contrib/libucl/ucl.h
+++ b/contrib/libucl/ucl.h
@@ -740,7 +740,7 @@ UCL_EXTERN int ucl_object_compare (const ucl_object_t *o1,
* @param cmp
*/
UCL_EXTERN void ucl_object_array_sort (ucl_object_t *ar,
- int (*cmp)(const ucl_object_t *o1, const ucl_object_t *o2));
+ int (*cmp)(const ucl_object_t **o1, const ucl_object_t **o2));
/**
* Get the priority for specific UCL object
diff --git a/contrib/libucl/ucl_chartable.h b/contrib/libucl/ucl_chartable.h
index 5248e117c..db9f02900 100644
--- a/contrib/libucl/ucl_chartable.h
+++ b/contrib/libucl/ucl_chartable.h
@@ -26,7 +26,7 @@
#include "ucl_internal.h"
-static const unsigned int ucl_chartable[255] = {
+static const unsigned int ucl_chartable[256] = {
UCL_CHARACTER_VALUE_END, UCL_CHARACTER_DENIED, UCL_CHARACTER_DENIED,
UCL_CHARACTER_DENIED, UCL_CHARACTER_DENIED, UCL_CHARACTER_DENIED,
UCL_CHARACTER_DENIED, UCL_CHARACTER_DENIED,
@@ -255,6 +255,7 @@ UCL_CHARACTER_KEY_START|UCL_CHARACTER_KEY|UCL_CHARACTER_VALUE_STR,
UCL_CHARACTER_KEY_START|UCL_CHARACTER_KEY|UCL_CHARACTER_VALUE_STR,
UCL_CHARACTER_KEY_START|UCL_CHARACTER_KEY|UCL_CHARACTER_VALUE_STR,
UCL_CHARACTER_KEY_START|UCL_CHARACTER_KEY|UCL_CHARACTER_VALUE_STR,
+UCL_CHARACTER_KEY_START|UCL_CHARACTER_KEY|UCL_CHARACTER_VALUE_STR,
UCL_CHARACTER_KEY_START|UCL_CHARACTER_KEY|UCL_CHARACTER_VALUE_STR
};
diff --git a/contrib/libucl/ucl_internal.h b/contrib/libucl/ucl_internal.h
index da7df1270..31d6b1361 100644
--- a/contrib/libucl/ucl_internal.h
+++ b/contrib/libucl/ucl_internal.h
@@ -309,7 +309,6 @@ __attribute__ (( format( printf, 2, 3) ));
static inline void
ucl_create_err (UT_string **err, const char *fmt, ...)
-
{
if (*err == NULL) {
utstring_new (*err);
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:
diff --git a/contrib/libucl/ucl_util.c b/contrib/libucl/ucl_util.c
index 9ea151e37..730a5c4af 100644
--- a/contrib/libucl/ucl_util.c
+++ b/contrib/libucl/ucl_util.c
@@ -3219,7 +3219,7 @@ ucl_object_compare (const ucl_object_t *o1, const ucl_object_t *o2)
void
ucl_object_array_sort (ucl_object_t *ar,
- int (*cmp)(const ucl_object_t *o1, const ucl_object_t *o2))
+ int (*cmp)(const ucl_object_t **o1, const ucl_object_t **o2))
{
UCL_ARRAY_GET (vec, ar);