summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJohn Mark Bell <jmb@netsurf-browser.org>2008-11-08 23:20:42 +0000
committerJohn Mark Bell <jmb@netsurf-browser.org>2008-11-08 23:20:42 +0000
commitf3c6e30f43c8e9feec891d68cc3eee99c3ef6264 (patch)
tree4c7c425167bc6cdb75666db1ceb2194ce8fab8ec
parent6df8f99a707326655b4f285920f19fef6d9eb90a (diff)
downloadlibhubbub-f3c6e30f43c8e9feec891d68cc3eee99c3ef6264.tar.gz
libhubbub-f3c6e30f43c8e9feec891d68cc3eee99c3ef6264.tar.bz2
Port hubbub to new lpu API
svn path=/trunk/hubbub/; revision=5656
-rw-r--r--src/parser.c7
-rw-r--r--src/tokeniser/tokeniser.c5
-rw-r--r--test/tokeniser.c5
-rw-r--r--test/tokeniser2.c5
-rw-r--r--test/tokeniser3.c5
5 files changed, 13 insertions, 14 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;
}
diff --git a/test/tokeniser.c b/test/tokeniser.c
index 77635bc..913b66f 100644
--- a/test/tokeniser.c
+++ b/test/tokeniser.c
@@ -38,9 +38,8 @@ int main(int argc, char **argv)
/* Initialise library */
assert(hubbub_initialise(argv[1], myrealloc, NULL) == HUBBUB_OK);
- stream = parserutils_inputstream_create("UTF-8", 0, NULL,
- myrealloc, NULL);
- assert(stream != NULL);
+ assert(parserutils_inputstream_create("UTF-8", 0, NULL,
+ myrealloc, NULL, &stream) == PARSERUTILS_OK);
tok = hubbub_tokeniser_create(stream, myrealloc, NULL);
assert(tok != NULL);
diff --git a/test/tokeniser2.c b/test/tokeniser2.c
index 3dee590..d033934 100644
--- a/test/tokeniser2.c
+++ b/test/tokeniser2.c
@@ -141,9 +141,8 @@ void run_test(context *ctx)
ctx->output_index = 0;
ctx->char_off = 0;
- stream = parserutils_inputstream_create("UTF-8", 0, NULL,
- myrealloc, NULL);
- assert(stream != NULL);
+ assert(parserutils_inputstream_create("UTF-8", 0, NULL,
+ myrealloc, NULL, &stream) == PARSERUTILS_OK);
tok = hubbub_tokeniser_create(stream, myrealloc, NULL);
assert(tok != NULL);
diff --git a/test/tokeniser3.c b/test/tokeniser3.c
index 8febda9..b7ca15e 100644
--- a/test/tokeniser3.c
+++ b/test/tokeniser3.c
@@ -138,9 +138,8 @@ void run_test(context *ctx)
ctx->output_index = 0;
ctx->char_off = 0;
- stream = parserutils_inputstream_create("UTF-8", 0, NULL,
- myrealloc, NULL);
- assert(stream != NULL);
+ assert(parserutils_inputstream_create("UTF-8", 0, NULL,
+ myrealloc, NULL, &stream) == PARSERUTILS_OK);
tok = hubbub_tokeniser_create(stream, myrealloc, NULL);
assert(tok != NULL);