@@ -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 |
@@ -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 | |||
}; | |||
@@ -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); |
@@ -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: |
@@ -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); | |||