Gitweb links:
...log
http://git.netsurf-browser.org/libhubbub.git/shortlog/243345506ea284242cd2b10844996f37080bde5a
...commit
http://git.netsurf-browser.org/libhubbub.git/commit/243345506ea284242cd2b10844996f37080bde5a
...tree
http://git.netsurf-browser.org/libhubbub.git/tree/243345506ea284242cd2b10844996f37080bde5a
The branch, master has been updated
via 243345506ea284242cd2b10844996f37080bde5a (commit)
via 0ddca8678be10d63548c1769ef0ebcd91e695718 (commit)
via a1af03965a04ad4e4e22978d47d87c858f479323 (commit)
via a84beea8c7bcf7180e1bd9bfe1481f41e4c4bd00 (commit)
via 882a2a3556a67f46cfb3bff77aff8c7ecad16c89 (commit)
via b79bb1babf272332dd6888721ae772851194049f (commit)
via 36334889d7ba35ef18e6e4997caef4d92df15245 (commit)
via d8583cd8f402cdb9c5372159ac17fdc092139f1c (commit)
from bc6de9c7af97c266f50a635cc4b972d3e2fd655a (commit)
Those revisions listed above that are new to this repository have
not appeared on any other notification email; so we list those
revisions in full, below.
- Log -----------------------------------------------------------------
commitdiff
http://git.netsurf-browser.org/libhubbub.git/commit/?id=243345506ea284242cd2b10844996f37080bde5a
commit 243345506ea284242cd2b10844996f37080bde5a
Author: Michael Drake <[email protected]>
Commit: Michael Drake <[email protected]>
Perf tester: Add sample build commands and clean target.
diff --git a/perf/example.mk b/perf/example.mk
index 7304ebb..a45fc8a 100644
--- a/perf/example.mk
+++ b/perf/example.mk
@@ -1,3 +1,10 @@
+# From the top level:
+#
+# make -C perf -f example.mk clean
+# make -C perf -f example.mk
+# time ./perf/libxml2 ~/Downloads/html5.html
+# time ./perf/hubbub ~/Downloads/html5.html
+
all: libxml2 hubbub
CC = gcc
@@ -15,3 +22,8 @@ hubbub: hubbub.c
hubbub: CFLAGS += `pkg-config --cflags libparserutils libhubbub`
hubbub: $(HUBBUB_OBJS)
gcc -o hubbub $(HUBBUB_OBJS) `pkg-config --libs libhubbub
libparserutils`
+
+.PHONY: clean
+clean:
+ $(RM) hubbub $(HUBBUB_OBJS)
+ $(RM) libxml2 $(LIBXML2_OBJS)
commitdiff
http://git.netsurf-browser.org/libhubbub.git/commit/?id=0ddca8678be10d63548c1769ef0ebcd91e695718
commit 0ddca8678be10d63548c1769ef0ebcd91e695718
Author: Michael Drake <[email protected]>
Commit: Michael Drake <[email protected]>
Perf tester: Hubbub doesn't support client allocation callback now.
diff --git a/perf/hubbub.c b/perf/hubbub.c
index 70e0630..c945fe6 100644
--- a/perf/hubbub.c
+++ b/perf/hubbub.c
@@ -113,13 +113,6 @@ static hubbub_tree_handler tree_handler = {
NULL
};
-static void *myrealloc(void *ptr, size_t len, void *pw)
-{
- UNUSED(pw);
-
- return realloc(ptr, len);
-}
-
int main(int argc, char **argv)
@@ -136,8 +129,7 @@ int main(int argc, char **argv)
return 1;
}
- assert(hubbub_parser_create("UTF-8", false, myrealloc, NULL, &parser) ==
- HUBBUB_OK);
+ assert(hubbub_parser_create("UTF-8", false, &parser) == HUBBUB_OK);
params.tree_handler = &tree_handler;
assert(hubbub_parser_setopt(parser, HUBBUB_PARSER_TREE_HANDLER,
commitdiff
http://git.netsurf-browser.org/libhubbub.git/commit/?id=a1af03965a04ad4e4e22978d47d87c858f479323
commit a1af03965a04ad4e4e22978d47d87c858f479323
Author: Michael Drake <[email protected]>
Commit: Michael Drake <[email protected]>
Perf tester: Remove bogus library initialisation/finalisation calls.
diff --git a/perf/hubbub.c b/perf/hubbub.c
index d0ca8ec..70e0630 100644
--- a/perf/hubbub.c
+++ b/perf/hubbub.c
@@ -131,14 +131,11 @@ int main(int argc, char **argv)
int fd;
uint8_t *file;
- if (argc != 3) {
- printf("Usage: %s <aliases_file> <filename>\n", argv[0]);
+ if (argc != 2) {
+ printf("Usage: %s <filename>\n", argv[0]);
return 1;
}
- /* Initialise library */
- assert(hubbub_initialise(argv[1], myrealloc, NULL) == HUBBUB_OK);
-
assert(hubbub_parser_create("UTF-8", false, myrealloc, NULL, &parser) ==
HUBBUB_OK);
@@ -150,15 +147,13 @@ int main(int argc, char **argv)
assert(hubbub_parser_setopt(parser, HUBBUB_PARSER_DOCUMENT_NODE,
¶ms) == HUBBUB_OK);
- stat(argv[2], &info);
- fd = open(argv[2], 0);
+ stat(argv[1], &info);
+ fd = open(argv[1], 0);
file = mmap(NULL, info.st_size, PROT_READ, MAP_SHARED, fd, 0);
assert(hubbub_parser_parse_chunk(parser, file, info.st_size)
== HUBBUB_OK);
- assert(hubbub_finalise(myrealloc, NULL) == HUBBUB_OK);
-
return HUBBUB_OK;
}
commitdiff
http://git.netsurf-browser.org/libhubbub.git/commit/?id=a84beea8c7bcf7180e1bd9bfe1481f41e4c4bd00
commit a84beea8c7bcf7180e1bd9bfe1481f41e4c4bd00
Author: Michael Drake <[email protected]>
Commit: Michael Drake <[email protected]>
Perf tester: Add change_encoding stub to tree callbacks.
diff --git a/perf/hubbub.c b/perf/hubbub.c
index 32ca061..d0ca8ec 100644
--- a/perf/hubbub.c
+++ b/perf/hubbub.c
@@ -89,6 +89,7 @@ static hubbub_error form_associate(void *ctx, void *form,
void *node);
static hubbub_error add_attributes(void *ctx, void *node,
const hubbub_attribute *attributes, uint32_t n_attributes);
static hubbub_error set_quirks_mode(void *ctx, hubbub_quirks_mode mode);
+static hubbub_error change_encoding(void *ctx, const char *charset);
static hubbub_tree_handler tree_handler = {
create_comment,
@@ -107,6 +108,7 @@ static hubbub_tree_handler tree_handler = {
form_associate,
add_attributes,
set_quirks_mode,
+ change_encoding,
NULL,
NULL
};
@@ -531,3 +533,11 @@ hubbub_error set_quirks_mode(void *ctx, hubbub_quirks_mode
mode)
return HUBBUB_OK;
}
+
+hubbub_error change_encoding(void *ctx, const char *charset)
+{
+ UNUSED(ctx);
+ UNUSED(charset);
+
+ return HUBBUB_OK;
+}
commitdiff
http://git.netsurf-browser.org/libhubbub.git/commit/?id=882a2a3556a67f46cfb3bff77aff8c7ecad16c89
commit 882a2a3556a67f46cfb3bff77aff8c7ecad16c89
Author: Michael Drake <[email protected]>
Commit: Michael Drake <[email protected]>
Perf tester: Tree handler callbacks return hubbub_error, not int.
diff --git a/perf/hubbub.c b/perf/hubbub.c
index 5cd55f6..32ca061 100644
--- a/perf/hubbub.c
+++ b/perf/hubbub.c
@@ -70,25 +70,25 @@ node_t *Document;
-static int create_comment(void *ctx, const hubbub_string *data, void **result);
-static int create_doctype(void *ctx, const hubbub_doctype *doctype,
+static hubbub_error create_comment(void *ctx, const hubbub_string *data, void
**result);
+static hubbub_error create_doctype(void *ctx, const hubbub_doctype *doctype,
void **result);
-static int create_element(void *ctx, const hubbub_tag *tag, void **result);
-static int create_text(void *ctx, const hubbub_string *data, void **result);
-static int ref_node(void *ctx, void *node);
-static int unref_node(void *ctx, void *node);
-static int append_child(void *ctx, void *parent, void *child, void **result);
-static int insert_before(void *ctx, void *parent, void *child, void *ref_child,
+static hubbub_error create_element(void *ctx, const hubbub_tag *tag, void
**result);
+static hubbub_error create_text(void *ctx, const hubbub_string *data, void
**result);
+static hubbub_error ref_node(void *ctx, void *node);
+static hubbub_error unref_node(void *ctx, void *node);
+static hubbub_error append_child(void *ctx, void *parent, void *child, void
**result);
+static hubbub_error insert_before(void *ctx, void *parent, void *child, void
*ref_child,
void **result);
-static int remove_child(void *ctx, void *parent, void *child, void **result);
-static int clone_node(void *ctx, void *node, bool deep, void **result);
-static int reparent_children(void *ctx, void *node, void *new_parent);
-static int get_parent(void *ctx, void *node, bool element_only, void **result);
-static int has_children(void *ctx, void *node, bool *result);
-static int form_associate(void *ctx, void *form, void *node);
-static int add_attributes(void *ctx, void *node,
+static hubbub_error remove_child(void *ctx, void *parent, void *child, void
**result);
+static hubbub_error clone_node(void *ctx, void *node, bool deep, void
**result);
+static hubbub_error reparent_children(void *ctx, void *node, void *new_parent);
+static hubbub_error get_parent(void *ctx, void *node, bool element_only, void
**result);
+static hubbub_error has_children(void *ctx, void *node, bool *result);
+static hubbub_error form_associate(void *ctx, void *form, void *node);
+static hubbub_error add_attributes(void *ctx, void *node,
const hubbub_attribute *attributes, uint32_t n_attributes);
-static int set_quirks_mode(void *ctx, hubbub_quirks_mode mode);
+static hubbub_error set_quirks_mode(void *ctx, hubbub_quirks_mode mode);
static hubbub_tree_handler tree_handler = {
create_comment,
@@ -157,13 +157,13 @@ int main(int argc, char **argv)
assert(hubbub_finalise(myrealloc, NULL) == HUBBUB_OK);
- return 0;
+ return HUBBUB_OK;
}
/*** Tree construction functions ***/
-int create_comment(void *ctx, const hubbub_string *data, void **result)
+hubbub_error create_comment(void *ctx, const hubbub_string *data, void
**result)
{
node_t *node = calloc(1, sizeof *node);
@@ -174,10 +174,10 @@ int create_comment(void *ctx, const hubbub_string *data,
void **result)
*result = node;
- return 0;
+ return HUBBUB_OK;
}
-int create_doctype(void *ctx, const hubbub_doctype *doctype, void **result)
+hubbub_error create_doctype(void *ctx, const hubbub_doctype *doctype, void
**result)
{
node_t *node = calloc(1, sizeof *node);
@@ -202,10 +202,10 @@ int create_doctype(void *ctx, const hubbub_doctype
*doctype, void **result)
*result = node;
- return 0;
+ return HUBBUB_OK;
}
-int create_element(void *ctx, const hubbub_tag *tag, void **result)
+hubbub_error create_element(void *ctx, const hubbub_tag *tag, void **result)
{
node_t *node = calloc(1, sizeof *node);
@@ -241,10 +241,10 @@ int create_element(void *ctx, const hubbub_tag *tag, void
**result)
*result = node;
- return 0;
+ return HUBBUB_OK;
}
-int create_text(void *ctx, const hubbub_string *data, void **result)
+hubbub_error create_text(void *ctx, const hubbub_string *data, void **result)
{
node_t *node = calloc(1, sizeof *node);
@@ -255,26 +255,26 @@ int create_text(void *ctx, const hubbub_string *data,
void **result)
*result = node;
- return 0;
+ return HUBBUB_OK;
}
-int ref_node(void *ctx, void *node)
+hubbub_error ref_node(void *ctx, void *node)
{
UNUSED(ctx);
UNUSED(node);
- return 0;
+ return HUBBUB_OK;
}
-int unref_node(void *ctx, void *node)
+hubbub_error unref_node(void *ctx, void *node)
{
UNUSED(ctx);
UNUSED(node);
- return 0;
+ return HUBBUB_OK;
}
-int append_child(void *ctx, void *parent, void *child, void **result)
+hubbub_error append_child(void *ctx, void *parent, void *child, void **result)
{
node_t *tparent = parent;
node_t *tchild = child;
@@ -319,11 +319,11 @@ int append_child(void *ctx, void *parent, void *child,
void **result)
}
}
- return 0;
+ return HUBBUB_OK;
}
/* insert 'child' before 'ref_child', under 'parent' */
-int insert_before(void *ctx, void *parent, void *child, void *ref_child,
+hubbub_error insert_before(void *ctx, void *parent, void *child, void
*ref_child,
void **result)
{
node_t *tparent = parent;
@@ -357,10 +357,10 @@ int insert_before(void *ctx, void *parent, void *child,
void *ref_child,
*result = child;
}
- return 0;
+ return HUBBUB_OK;
}
-int remove_child(void *ctx, void *parent, void *child, void **result)
+hubbub_error remove_child(void *ctx, void *parent, void *child, void **result)
{
node_t *tparent = parent;
node_t *tchild = child;
@@ -385,10 +385,10 @@ int remove_child(void *ctx, void *parent, void *child,
void **result)
*result = child;
- return 0;
+ return HUBBUB_OK;
}
-int clone_node(void *ctx, void *node, bool deep, void **result)
+hubbub_error clone_node(void *ctx, void *node, bool deep, void **result)
{
node_t *old_node = node;
node_t *new_node = calloc(1, sizeof *new_node);
@@ -403,7 +403,7 @@ int clone_node(void *ctx, void *node, bool deep, void
**result)
NULL;
if (deep == false)
- return 0;
+ return HUBBUB_OK;
if (old_node->next) {
void *n;
@@ -423,11 +423,11 @@ int clone_node(void *ctx, void *node, bool deep, void
**result)
new_node->child->parent = new_node;
}
- return 0;
+ return HUBBUB_OK;
}
/* Take all of the child nodes of "node" and append them to "new_parent" */
-int reparent_children(void *ctx, void *node, void *new_parent)
+hubbub_error reparent_children(void *ctx, void *node, void *new_parent)
{
node_t *parent = new_parent;
node_t *old_parent = node;
@@ -438,7 +438,7 @@ int reparent_children(void *ctx, void *node, void
*new_parent)
UNUSED(ctx);
kids = old_parent->child;
- if (!kids) return 0;
+ if (!kids) return HUBBUB_OK;
old_parent->child = NULL;
@@ -459,38 +459,38 @@ int reparent_children(void *ctx, void *node, void
*new_parent)
kids = kids->next;
}
- return 0;
+ return HUBBUB_OK;
}
-int get_parent(void *ctx, void *node, bool element_only, void **result)
+hubbub_error get_parent(void *ctx, void *node, bool element_only, void
**result)
{
UNUSED(ctx);
UNUSED(element_only);
*result = ((node_t *)node)->parent;
- return 0;
+ return HUBBUB_OK;
}
-int has_children(void *ctx, void *node, bool *result)
+hubbub_error has_children(void *ctx, void *node, bool *result)
{
UNUSED(ctx);
*result = ((node_t *)node)->child ? true : false;
- return 0;
+ return HUBBUB_OK;
}
-int form_associate(void *ctx, void *form, void *node)
+hubbub_error form_associate(void *ctx, void *form, void *node)
{
UNUSED(ctx);
UNUSED(form);
UNUSED(node);
- return 0;
+ return HUBBUB_OK;
}
-int add_attributes(void *ctx, void *vnode,
+hubbub_error add_attributes(void *ctx, void *vnode,
const hubbub_attribute *attributes, uint32_t n_attributes)
{
node_t *node = vnode;
@@ -521,13 +521,13 @@ int add_attributes(void *ctx, void *vnode,
}
- return 0;
+ return HUBBUB_OK;
}
-int set_quirks_mode(void *ctx, hubbub_quirks_mode mode)
+hubbub_error set_quirks_mode(void *ctx, hubbub_quirks_mode mode)
{
UNUSED(ctx);
UNUSED(mode);
- return 0;
+ return HUBBUB_OK;
}
commitdiff
http://git.netsurf-browser.org/libhubbub.git/commit/?id=b79bb1babf272332dd6888721ae772851194049f
commit b79bb1babf272332dd6888721ae772851194049f
Author: Michael Drake <[email protected]>
Commit: Michael Drake <[email protected]>
Perf tester: Squash duplicate const qualifier warning.
diff --git a/perf/hubbub.c b/perf/hubbub.c
index 8c6f937..5cd55f6 100644
--- a/perf/hubbub.c
+++ b/perf/hubbub.c
@@ -62,7 +62,7 @@ struct buf_t {
#define NUM_NAMESPACES 7
-const char const *ns_names[NUM_NAMESPACES] =
+const char *ns_names[NUM_NAMESPACES] =
{ NULL, NULL /*html*/, "math", "svg", "xlink", "xml", "xmlns" };
commitdiff
http://git.netsurf-browser.org/libhubbub.git/commit/?id=36334889d7ba35ef18e6e4997caef4d92df15245
commit 36334889d7ba35ef18e6e4997caef4d92df15245
Author: Michael Drake <[email protected]>
Commit: Michael Drake <[email protected]>
Example: Add sample build instructions.
diff --git a/examples/example.mk b/examples/example.mk
index 8c5d828..2d04553 100644
--- a/examples/example.mk
+++ b/examples/example.mk
@@ -1,3 +1,9 @@
+# From the top level:
+#
+# make -C examples -f example.mk clean
+# make -C examples -f example.mk
+# ./examples/libxml test/data/html/misnested.html
+
CC := gcc
LD := gcc
commitdiff
http://git.netsurf-browser.org/libhubbub.git/commit/?id=d8583cd8f402cdb9c5372159ac17fdc092139f1c
commit d8583cd8f402cdb9c5372159ac17fdc092139f1c
Author: Michael Drake <[email protected]>
Commit: Michael Drake <[email protected]>
Example: Add debugXML.h for xmlDebugDumpDocument().
diff --git a/examples/libxml.c b/examples/libxml.c
index 9530ca3..7fa6090 100644
--- a/examples/libxml.c
+++ b/examples/libxml.c
@@ -14,6 +14,7 @@
#include <libxml/HTMLparser.h>
#include <libxml/HTMLtree.h>
+#include <libxml/debugXML.h>
#include <hubbub/parser.h>
#include <hubbub/tree.h>
-----------------------------------------------------------------------
Summary of changes:
examples/example.mk | 6 +++
examples/libxml.c | 1 +
perf/example.mk | 12 +++++
perf/hubbub.c | 137 +++++++++++++++++++++++++--------------------------
4 files changed, 86 insertions(+), 70 deletions(-)
diff --git a/examples/example.mk b/examples/example.mk
index 8c5d828..2d04553 100644
--- a/examples/example.mk
+++ b/examples/example.mk
@@ -1,3 +1,9 @@
+# From the top level:
+#
+# make -C examples -f example.mk clean
+# make -C examples -f example.mk
+# ./examples/libxml test/data/html/misnested.html
+
CC := gcc
LD := gcc
diff --git a/examples/libxml.c b/examples/libxml.c
index 9530ca3..7fa6090 100644
--- a/examples/libxml.c
+++ b/examples/libxml.c
@@ -14,6 +14,7 @@
#include <libxml/HTMLparser.h>
#include <libxml/HTMLtree.h>
+#include <libxml/debugXML.h>
#include <hubbub/parser.h>
#include <hubbub/tree.h>
diff --git a/perf/example.mk b/perf/example.mk
index 7304ebb..a45fc8a 100644
--- a/perf/example.mk
+++ b/perf/example.mk
@@ -1,3 +1,10 @@
+# From the top level:
+#
+# make -C perf -f example.mk clean
+# make -C perf -f example.mk
+# time ./perf/libxml2 ~/Downloads/html5.html
+# time ./perf/hubbub ~/Downloads/html5.html
+
all: libxml2 hubbub
CC = gcc
@@ -15,3 +22,8 @@ hubbub: hubbub.c
hubbub: CFLAGS += `pkg-config --cflags libparserutils libhubbub`
hubbub: $(HUBBUB_OBJS)
gcc -o hubbub $(HUBBUB_OBJS) `pkg-config --libs libhubbub
libparserutils`
+
+.PHONY: clean
+clean:
+ $(RM) hubbub $(HUBBUB_OBJS)
+ $(RM) libxml2 $(LIBXML2_OBJS)
diff --git a/perf/hubbub.c b/perf/hubbub.c
index 8c6f937..c945fe6 100644
--- a/perf/hubbub.c
+++ b/perf/hubbub.c
@@ -62,7 +62,7 @@ struct buf_t {
#define NUM_NAMESPACES 7
-const char const *ns_names[NUM_NAMESPACES] =
+const char *ns_names[NUM_NAMESPACES] =
{ NULL, NULL /*html*/, "math", "svg", "xlink", "xml", "xmlns" };
@@ -70,25 +70,26 @@ node_t *Document;
-static int create_comment(void *ctx, const hubbub_string *data, void **result);
-static int create_doctype(void *ctx, const hubbub_doctype *doctype,
+static hubbub_error create_comment(void *ctx, const hubbub_string *data, void
**result);
+static hubbub_error create_doctype(void *ctx, const hubbub_doctype *doctype,
void **result);
-static int create_element(void *ctx, const hubbub_tag *tag, void **result);
-static int create_text(void *ctx, const hubbub_string *data, void **result);
-static int ref_node(void *ctx, void *node);
-static int unref_node(void *ctx, void *node);
-static int append_child(void *ctx, void *parent, void *child, void **result);
-static int insert_before(void *ctx, void *parent, void *child, void *ref_child,
+static hubbub_error create_element(void *ctx, const hubbub_tag *tag, void
**result);
+static hubbub_error create_text(void *ctx, const hubbub_string *data, void
**result);
+static hubbub_error ref_node(void *ctx, void *node);
+static hubbub_error unref_node(void *ctx, void *node);
+static hubbub_error append_child(void *ctx, void *parent, void *child, void
**result);
+static hubbub_error insert_before(void *ctx, void *parent, void *child, void
*ref_child,
void **result);
-static int remove_child(void *ctx, void *parent, void *child, void **result);
-static int clone_node(void *ctx, void *node, bool deep, void **result);
-static int reparent_children(void *ctx, void *node, void *new_parent);
-static int get_parent(void *ctx, void *node, bool element_only, void **result);
-static int has_children(void *ctx, void *node, bool *result);
-static int form_associate(void *ctx, void *form, void *node);
-static int add_attributes(void *ctx, void *node,
+static hubbub_error remove_child(void *ctx, void *parent, void *child, void
**result);
+static hubbub_error clone_node(void *ctx, void *node, bool deep, void
**result);
+static hubbub_error reparent_children(void *ctx, void *node, void *new_parent);
+static hubbub_error get_parent(void *ctx, void *node, bool element_only, void
**result);
+static hubbub_error has_children(void *ctx, void *node, bool *result);
+static hubbub_error form_associate(void *ctx, void *form, void *node);
+static hubbub_error add_attributes(void *ctx, void *node,
const hubbub_attribute *attributes, uint32_t n_attributes);
-static int set_quirks_mode(void *ctx, hubbub_quirks_mode mode);
+static hubbub_error set_quirks_mode(void *ctx, hubbub_quirks_mode mode);
+static hubbub_error change_encoding(void *ctx, const char *charset);
static hubbub_tree_handler tree_handler = {
create_comment,
@@ -107,17 +108,11 @@ static hubbub_tree_handler tree_handler = {
form_associate,
add_attributes,
set_quirks_mode,
+ change_encoding,
NULL,
NULL
};
-static void *myrealloc(void *ptr, size_t len, void *pw)
-{
- UNUSED(pw);
-
- return realloc(ptr, len);
-}
-
int main(int argc, char **argv)
@@ -129,16 +124,12 @@ int main(int argc, char **argv)
int fd;
uint8_t *file;
- if (argc != 3) {
- printf("Usage: %s <aliases_file> <filename>\n", argv[0]);
+ if (argc != 2) {
+ printf("Usage: %s <filename>\n", argv[0]);
return 1;
}
- /* Initialise library */
- assert(hubbub_initialise(argv[1], myrealloc, NULL) == HUBBUB_OK);
-
- assert(hubbub_parser_create("UTF-8", false, myrealloc, NULL, &parser) ==
- HUBBUB_OK);
+ assert(hubbub_parser_create("UTF-8", false, &parser) == HUBBUB_OK);
params.tree_handler = &tree_handler;
assert(hubbub_parser_setopt(parser, HUBBUB_PARSER_TREE_HANDLER,
@@ -148,22 +139,20 @@ int main(int argc, char **argv)
assert(hubbub_parser_setopt(parser, HUBBUB_PARSER_DOCUMENT_NODE,
¶ms) == HUBBUB_OK);
- stat(argv[2], &info);
- fd = open(argv[2], 0);
+ stat(argv[1], &info);
+ fd = open(argv[1], 0);
file = mmap(NULL, info.st_size, PROT_READ, MAP_SHARED, fd, 0);
assert(hubbub_parser_parse_chunk(parser, file, info.st_size)
== HUBBUB_OK);
- assert(hubbub_finalise(myrealloc, NULL) == HUBBUB_OK);
-
- return 0;
+ return HUBBUB_OK;
}
/*** Tree construction functions ***/
-int create_comment(void *ctx, const hubbub_string *data, void **result)
+hubbub_error create_comment(void *ctx, const hubbub_string *data, void
**result)
{
node_t *node = calloc(1, sizeof *node);
@@ -174,10 +163,10 @@ int create_comment(void *ctx, const hubbub_string *data,
void **result)
*result = node;
- return 0;
+ return HUBBUB_OK;
}
-int create_doctype(void *ctx, const hubbub_doctype *doctype, void **result)
+hubbub_error create_doctype(void *ctx, const hubbub_doctype *doctype, void
**result)
{
node_t *node = calloc(1, sizeof *node);
@@ -202,10 +191,10 @@ int create_doctype(void *ctx, const hubbub_doctype
*doctype, void **result)
*result = node;
- return 0;
+ return HUBBUB_OK;
}
-int create_element(void *ctx, const hubbub_tag *tag, void **result)
+hubbub_error create_element(void *ctx, const hubbub_tag *tag, void **result)
{
node_t *node = calloc(1, sizeof *node);
@@ -241,10 +230,10 @@ int create_element(void *ctx, const hubbub_tag *tag, void
**result)
*result = node;
- return 0;
+ return HUBBUB_OK;
}
-int create_text(void *ctx, const hubbub_string *data, void **result)
+hubbub_error create_text(void *ctx, const hubbub_string *data, void **result)
{
node_t *node = calloc(1, sizeof *node);
@@ -255,26 +244,26 @@ int create_text(void *ctx, const hubbub_string *data,
void **result)
*result = node;
- return 0;
+ return HUBBUB_OK;
}
-int ref_node(void *ctx, void *node)
+hubbub_error ref_node(void *ctx, void *node)
{
UNUSED(ctx);
UNUSED(node);
- return 0;
+ return HUBBUB_OK;
}
-int unref_node(void *ctx, void *node)
+hubbub_error unref_node(void *ctx, void *node)
{
UNUSED(ctx);
UNUSED(node);
- return 0;
+ return HUBBUB_OK;
}
-int append_child(void *ctx, void *parent, void *child, void **result)
+hubbub_error append_child(void *ctx, void *parent, void *child, void **result)
{
node_t *tparent = parent;
node_t *tchild = child;
@@ -319,11 +308,11 @@ int append_child(void *ctx, void *parent, void *child,
void **result)
}
}
- return 0;
+ return HUBBUB_OK;
}
/* insert 'child' before 'ref_child', under 'parent' */
-int insert_before(void *ctx, void *parent, void *child, void *ref_child,
+hubbub_error insert_before(void *ctx, void *parent, void *child, void
*ref_child,
void **result)
{
node_t *tparent = parent;
@@ -357,10 +346,10 @@ int insert_before(void *ctx, void *parent, void *child,
void *ref_child,
*result = child;
}
- return 0;
+ return HUBBUB_OK;
}
-int remove_child(void *ctx, void *parent, void *child, void **result)
+hubbub_error remove_child(void *ctx, void *parent, void *child, void **result)
{
node_t *tparent = parent;
node_t *tchild = child;
@@ -385,10 +374,10 @@ int remove_child(void *ctx, void *parent, void *child,
void **result)
*result = child;
- return 0;
+ return HUBBUB_OK;
}
-int clone_node(void *ctx, void *node, bool deep, void **result)
+hubbub_error clone_node(void *ctx, void *node, bool deep, void **result)
{
node_t *old_node = node;
node_t *new_node = calloc(1, sizeof *new_node);
@@ -403,7 +392,7 @@ int clone_node(void *ctx, void *node, bool deep, void
**result)
NULL;
if (deep == false)
- return 0;
+ return HUBBUB_OK;
if (old_node->next) {
void *n;
@@ -423,11 +412,11 @@ int clone_node(void *ctx, void *node, bool deep, void
**result)
new_node->child->parent = new_node;
}
- return 0;
+ return HUBBUB_OK;
}
/* Take all of the child nodes of "node" and append them to "new_parent" */
-int reparent_children(void *ctx, void *node, void *new_parent)
+hubbub_error reparent_children(void *ctx, void *node, void *new_parent)
{
node_t *parent = new_parent;
node_t *old_parent = node;
@@ -438,7 +427,7 @@ int reparent_children(void *ctx, void *node, void
*new_parent)
UNUSED(ctx);
kids = old_parent->child;
- if (!kids) return 0;
+ if (!kids) return HUBBUB_OK;
old_parent->child = NULL;
@@ -459,38 +448,38 @@ int reparent_children(void *ctx, void *node, void
*new_parent)
kids = kids->next;
}
- return 0;
+ return HUBBUB_OK;
}
-int get_parent(void *ctx, void *node, bool element_only, void **result)
+hubbub_error get_parent(void *ctx, void *node, bool element_only, void
**result)
{
UNUSED(ctx);
UNUSED(element_only);
*result = ((node_t *)node)->parent;
- return 0;
+ return HUBBUB_OK;
}
-int has_children(void *ctx, void *node, bool *result)
+hubbub_error has_children(void *ctx, void *node, bool *result)
{
UNUSED(ctx);
*result = ((node_t *)node)->child ? true : false;
- return 0;
+ return HUBBUB_OK;
}
-int form_associate(void *ctx, void *form, void *node)
+hubbub_error form_associate(void *ctx, void *form, void *node)
{
UNUSED(ctx);
UNUSED(form);
UNUSED(node);
- return 0;
+ return HUBBUB_OK;
}
-int add_attributes(void *ctx, void *vnode,
+hubbub_error add_attributes(void *ctx, void *vnode,
const hubbub_attribute *attributes, uint32_t n_attributes)
{
node_t *node = vnode;
@@ -521,13 +510,21 @@ int add_attributes(void *ctx, void *vnode,
}
- return 0;
+ return HUBBUB_OK;
}
-int set_quirks_mode(void *ctx, hubbub_quirks_mode mode)
+hubbub_error set_quirks_mode(void *ctx, hubbub_quirks_mode mode)
{
UNUSED(ctx);
UNUSED(mode);
- return 0;
+ return HUBBUB_OK;
+}
+
+hubbub_error change_encoding(void *ctx, const char *charset)
+{
+ UNUSED(ctx);
+ UNUSED(charset);
+
+ return HUBBUB_OK;
}
--
HTML5 parser library
_______________________________________________
netsurf-commits mailing list -- [email protected]
To unsubscribe send an email to [email protected]