summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMichael Drake <tlsa@netsurf-browser.org>2010-12-30 13:48:26 (GMT)
committer Michael Drake <tlsa@netsurf-browser.org>2010-12-30 13:48:26 (GMT)
commit189095f8f329c1e98c2d9f541420f7041d446016 (patch)
tree4950aa60c8f2fdcfd11d807214da4391cfdc53fc
parent8dc5a6faab7b48282c5b3354a018521b4716b271 (diff)
downloadlibhubbub-189095f8f329c1e98c2d9f541420f7041d446016.tar.gz
libhubbub-189095f8f329c1e98c2d9f541420f7041d446016.tar.bz2
Fix example.
svn path=/trunk/hubbub/; revision=11172
-rw-r--r--examples/libxml.c19
1 files changed, 4 insertions, 15 deletions
diff --git a/examples/libxml.c b/examples/libxml.c
index fd87089..1e787e2 100644
--- a/examples/libxml.c
+++ b/examples/libxml.c
@@ -163,21 +163,17 @@ int main(int argc, char **argv)
uint8_t *buf;
size_t len;
- if (argc != 3) {
- fprintf(stderr, "Usage: %s <Aliases> <input>\n", argv[0]);
+ if (argc != 2) {
+ fprintf(stderr, "Usage: %s <input>\n", argv[0]);
return 1;
}
- /* Initialise hubbub */
- assert(hubbub_initialise(argv[1], myrealloc, NULL) == HUBBUB_OK);
-
/* Read input file into memory. If we wanted to, we could read into
* a fixed-size buffer and pass each chunk to the parser sequentially.
*/
- input = fopen(argv[2], "r");
+ input = fopen(argv[1], "r");
if (input == NULL) {
- hubbub_finalise(myrealloc, NULL);
- fprintf(stderr, "Failed opening %s\n", argv[2]);
+ fprintf(stderr, "Failed opening %s\n", argv[1]);
return 1;
}
@@ -188,7 +184,6 @@ int main(int argc, char **argv)
buf = malloc(len);
if (buf == NULL) {
fclose(input);
- hubbub_finalise(myrealloc, NULL);
fprintf(stderr, "No memory for buf\n");
return 1;
}
@@ -200,7 +195,6 @@ int main(int argc, char **argv)
if (error != OK) {
free(buf);
fclose(input);
- hubbub_finalise(myrealloc, NULL);
fprintf(stderr, "Failed creating parsing context\n");
return 1;
}
@@ -226,7 +220,6 @@ int main(int argc, char **argv)
destroy_context(c);
free(buf);
fclose(input);
- hubbub_finalise(myrealloc, NULL);
fprintf(stderr, "Failed recreating parser\n");
return 1;
}
@@ -242,7 +235,6 @@ int main(int argc, char **argv)
destroy_context(c);
free(buf);
fclose(input);
- hubbub_finalise(myrealloc, NULL);
fprintf(stderr, "Failed parsing document\n");
return 1;
}
@@ -254,7 +246,6 @@ int main(int argc, char **argv)
destroy_context(c);
free(buf);
fclose(input);
- hubbub_finalise(myrealloc, NULL);
fprintf(stderr, "Failed parsing document\n");
return 1;
}
@@ -274,8 +265,6 @@ int main(int argc, char **argv)
fclose(input);
- hubbub_finalise(myrealloc, NULL);
-
return 0;
}