diff options
Diffstat (limited to 'src')
-rw-r--r-- | src/parser.c | 7 | ||||
-rw-r--r-- | src/tokeniser/tokeniser.c | 5 |
2 files changed, 7 insertions, 5 deletions
diff --git a/src/parser.c b/src/parser.c index 075a0e2..342f19b 100644 --- a/src/parser.c +++ b/src/parser.c @@ -40,6 +40,7 @@ struct hubbub_parser { hubbub_parser *hubbub_parser_create(const char *enc, bool fix_enc, hubbub_alloc alloc, void *pw) { + parserutils_error perror; hubbub_parser *parser; if (alloc == NULL) @@ -62,10 +63,10 @@ hubbub_parser *hubbub_parser_create(const char *enc, bool fix_enc, } } - parser->stream = parserutils_inputstream_create(enc, + perror = parserutils_inputstream_create(enc, enc != NULL ? HUBBUB_CHARSET_CONFIDENT : HUBBUB_CHARSET_UNKNOWN, - hubbub_charset_extract, alloc, pw); - if (parser->stream == NULL) { + hubbub_charset_extract, alloc, pw, &parser->stream); + if (perror != PARSERUTILS_OK) { alloc(parser, 0, pw); return NULL; } diff --git a/src/tokeniser/tokeniser.c b/src/tokeniser/tokeniser.c index 5563a58..b5d9e07 100644 --- a/src/tokeniser/tokeniser.c +++ b/src/tokeniser/tokeniser.c @@ -281,6 +281,7 @@ static hubbub_error hubbub_tokeniser_emit_token(hubbub_tokeniser *tokeniser, hubbub_tokeniser *hubbub_tokeniser_create(parserutils_inputstream *input, hubbub_alloc alloc, void *pw) { + parserutils_error perror; hubbub_tokeniser *tok; if (input == NULL || alloc == NULL) @@ -290,8 +291,8 @@ hubbub_tokeniser *hubbub_tokeniser_create(parserutils_inputstream *input, if (tok == NULL) return NULL; - tok->buffer = parserutils_buffer_create(alloc, pw); - if (tok->buffer == NULL) { + perror = parserutils_buffer_create(alloc, pw, &tok->buffer); + if (perror != PARSERUTILS_OK) { alloc(tok, 0, pw); return NULL; } |