HASH_ITER (hh, obj, cur, tmp) {
ucl_add_tabs (buf, tabs + 1, is_top);
- if (obj->flags & UCL_OBJECT_NEED_KEY_ESCAPE) {
+ if (cur->flags & UCL_OBJECT_NEED_KEY_ESCAPE) {
ucl_elt_string_write_json (cur->hh.key, cur->hh.keylen, buf);
}
else {
i == '"' || i == '\f') {
r += print_flag ("UCL_CHARACTER_JSON_UNSAFE", &need_or, valbuf + r);
}
+ if (i == '\n' || i == '\r' || i == '\\' || i == '\b' || i == '\t' ||
+ i == '"' || i == '\f' || i == '=' || i == ':' || i == '{' || i == '[' || i == ' ') {
+ r += print_flag ("UCL_CHARACTER_UCL_UNSAFE", &need_or, valbuf + r);
+ }
if (!need_or) {
r += print_flag ("UCL_CHARACTER_DENIED", &need_or, valbuf + r);
const char *fn = NULL;
char inbuf[8192];
struct ucl_parser *parser;
- UT_string *err = NULL;
int k, ret = 0;
ucl_object_t *obj = NULL;
ucl_object_t *par;
parser = ucl_parser_new (0);
while (!feof (in)) {
fread (inbuf, sizeof (inbuf), 1, in);
- ucl_parser_add_chunk (parser, inbuf, strlen (inbuf), &err);
+ ucl_parser_add_chunk (parser, inbuf, strlen (inbuf));
}
fclose (in);
- if (err != NULL ) {
- printf ("Error occured: %s\n", err->d);
+ if (ucl_parser_get_error(parser) ) {
+ printf ("Error occured: %s\n", ucl_parser_get_error(parser));
ret = 1;
goto end;
}
- obj = ucl_parser_get_object (parser, &err);
- if (err != NULL ) {
- printf ("Error occured: %s\n", err->d);
+ obj = ucl_parser_get_object (parser);
+ if (ucl_parser_get_error(parser)) {
+ printf ("Error occured: %s\n", ucl_parser_get_error(parser));
ret = 1;
goto end;
}