diff options
author | bapt <bapt@FreeBSD.org> | 2014-04-22 22:02:06 +0000 |
---|---|---|
committer | bapt <bapt@FreeBSD.org> | 2014-04-22 22:02:06 +0000 |
commit | 8286a6069a68d13dc8ef55a25885a57aa127dde3 (patch) | |
tree | 72be8a76cd83688338f881c969e6dfc0583ec8ff /contrib/libucl/src/ucl_parser.c | |
parent | 418b7ad78192cd30c84465a025da93f4d87a8491 (diff) | |
download | FreeBSD-src-8286a6069a68d13dc8ef55a25885a57aa127dde3.zip FreeBSD-src-8286a6069a68d13dc8ef55a25885a57aa127dde3.tar.gz |
Import libucl 0.4.0
Adapt pkg(7) to the new libucl API
Diffstat (limited to 'contrib/libucl/src/ucl_parser.c')
-rw-r--r-- | contrib/libucl/src/ucl_parser.c | 34 |
1 files changed, 3 insertions, 31 deletions
diff --git a/contrib/libucl/src/ucl_parser.c b/contrib/libucl/src/ucl_parser.c index a067286..d5a085e 100644 --- a/contrib/libucl/src/ucl_parser.c +++ b/contrib/libucl/src/ucl_parser.c @@ -55,34 +55,6 @@ struct ucl_parser_saved_state { (chunk)->remain --; \ } while (0) -/** - * Save parser state - * @param chunk - * @param s - */ -static inline void -ucl_chunk_save_state (struct ucl_chunk *chunk, struct ucl_parser_saved_state *s) -{ - s->column = chunk->column; - s->pos = chunk->pos; - s->line = chunk->line; - s->remain = chunk->remain; -} - -/** - * Restore parser state - * @param chunk - * @param s - */ -static inline void -ucl_chunk_restore_state (struct ucl_chunk *chunk, struct ucl_parser_saved_state *s) -{ - chunk->column = s->column; - chunk->pos = s->pos; - chunk->line = s->line; - chunk->remain = s->remain; -} - static inline void ucl_set_err (struct ucl_chunk *chunk, int code, const char *str, UT_string **err) { @@ -1086,19 +1058,19 @@ ucl_parse_key (struct ucl_parser *parser, struct ucl_chunk *chunk, bool *next_ke keylen = ucl_copy_or_store_ptr (parser, c, &nobj->trash_stack[UCL_TRASH_KEY], &key, end - c, need_unescape, parser->flags & UCL_PARSER_KEY_LOWERCASE, false); if (keylen == -1) { - ucl_object_free(nobj); + ucl_object_unref (nobj); return false; } else if (keylen == 0) { ucl_set_err (chunk, UCL_ESYNTAX, "empty keys are not allowed", &parser->err); - ucl_object_free(nobj); + ucl_object_unref (nobj); return false; } container = parser->stack->obj->value.ov; nobj->key = key; nobj->keylen = keylen; - tobj = ucl_hash_search_obj (container, nobj); + tobj = __DECONST (ucl_object_t *, ucl_hash_search_obj (container, nobj)); if (tobj == NULL) { container = ucl_hash_insert_object (container, nobj); nobj->prev = nobj; |