summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJohn-Mark Bell <jmb@netsurf-browser.org>2013-02-27 04:40:09 (GMT)
committer John-Mark Bell <jmb@netsurf-browser.org>2013-02-27 04:40:09 (GMT)
commit4e091eb81e7a5ada5d8aafa7990d094f276f2099 (patch)
treebc109c5c5e658d046e19a3aed96ee7614135f7f2
parent1dee56a7494a71a73dfc83a605d02e9450bf7e25 (diff)
downloadlibhubbub-4e091eb81e7a5ada5d8aafa7990d094f276f2099.tar.gz
libhubbub-4e091eb81e7a5ada5d8aafa7990d094f276f2099.tar.bz2
Fix handling of encoding change
-rw-r--r--examples/libxml.c15
1 files changed, 8 insertions, 7 deletions
diff --git a/examples/libxml.c b/examples/libxml.c
index 1e787e2..e970e4c 100644
--- a/examples/libxml.c
+++ b/examples/libxml.c
@@ -213,19 +213,20 @@ int main(int argc, char **argv)
* change_encoding() will have put the new charset into
* c->encoding.
*/
- hubbub_parser *temp;
+ context *c2;
- if (hubbub_parser_create(c->encoding, true, myrealloc, NULL,
- &temp) != HUBBUB_OK) {
- destroy_context(c);
+ error = create_context(c->encoding, &c2);
+ if (error != OK) {
+ destroy_context(c2);
free(buf);
fclose(input);
- fprintf(stderr, "Failed recreating parser\n");
+ fprintf(stderr, "Failed recreating context\n");
return 1;
}
- hubbub_parser_destroy(c->parser);
- c->parser = temp;
+ destroy_context(c);
+
+ c = c2;
/* Retry the parse */
error = parse_chunk(c, buf, len);