diff options
author | Vincent Sanders <vincent.sanders@collabora.co.uk> | 2012-07-03 19:39:36 +0100 |
---|---|---|
committer | Vincent Sanders <vincent.sanders@collabora.co.uk> | 2012-07-03 19:39:36 +0100 |
commit | c65586bb921f0b7dbad818a057507609d59d4821 (patch) | |
tree | 9234e641b35a8915ff75ff77156bcb0fce6c925b /src/parser.c | |
parent | a256763c038714124858954cc3c4fc024191dfdd (diff) | |
download | libhubbub-c65586bb921f0b7dbad818a057507609d59d4821.tar.gz libhubbub-c65586bb921f0b7dbad818a057507609d59d4821.tar.bz2 |
add hubbub_parser_insert_chunk
Diffstat (limited to 'src/parser.c')
-rw-r--r-- | src/parser.c | 27 |
1 files changed, 27 insertions, 0 deletions
diff --git a/src/parser.c b/src/parser.c index 9d54049..95216a3 100644 --- a/src/parser.c +++ b/src/parser.c @@ -200,6 +200,33 @@ hubbub_error hubbub_parser_setopt(hubbub_parser *parser, } /** + * Insert a chunk of data into a hubbub parser input stream + * + * Inserts the given data into the input stream ready for parsing but + * does not cause any additional processing of the input. This is + * useful to allow hubbub callbacks to add computed data to the input. + * + * \param parser Parser instance to use + * \param data Data to parse (encoded in the input charset) + * \param len Length, in bytes, of data + * \return HUBBUB_OK on success, appropriate error otherwise + */ +hubbub_error hubbub_parser_insert_chunk(hubbub_parser *parser, + const uint8_t *data, size_t len) +{ + parserutils_error perror; + + if (parser == NULL || data == NULL) + return HUBBUB_BADPARM; + + perror = parserutils_inputstream_insert(parser->stream, data, len); + if (perror != PARSERUTILS_OK) + return hubbub_error_from_parserutils_error(perror); + + return HUBBUB_OK; +} + +/** * Pass a chunk of data to a hubbub parser for parsing * * \param parser Parser instance to use |