summaryrefslogtreecommitdiff
path: root/test
diff options
context:
space:
mode:
authorJohn Mark Bell <jmb@netsurf-browser.org>2009-04-15 11:02:53 +0000
committerJohn Mark Bell <jmb@netsurf-browser.org>2009-04-15 11:02:53 +0000
commitb50dc50a2b25c7cc77843b25adc41575cfce7fd6 (patch)
tree68d81123fda9d7df3aa15375e12ea034896a1c87 /test
parent051158ffe97eb9b4a1a4b9b5ea719c7e38509200 (diff)
downloadlibhubbub-b50dc50a2b25c7cc77843b25adc41575cfce7fd6.tar.gz
libhubbub-b50dc50a2b25c7cc77843b25adc41575cfce7fd6.tar.bz2
Manually merge r7070 into trunk
svn path=/trunk/hubbub/; revision=7082
Diffstat (limited to 'test')
-rw-r--r--test/tree-buf.c99
-rw-r--r--test/tree.c105
-rw-r--r--test/tree2.c103
3 files changed, 159 insertions, 148 deletions
diff --git a/test/tree-buf.c b/test/tree-buf.c
index 658e8e8..923573d 100644
--- a/test/tree-buf.c
+++ b/test/tree-buf.c
@@ -74,25 +74,25 @@ node_t *Document;
static void node_print(buf_t *buf, node_t *node, unsigned depth);
-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 void delete_node(node_t *node);
static void delete_attr(attr_t *attr);
@@ -278,7 +278,7 @@ int main(int argc, char **argv)
/*** 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);
@@ -291,10 +291,11 @@ 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);
@@ -320,10 +321,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);
@@ -360,10 +361,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);
@@ -376,10 +377,10 @@ 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)
{
node_t *n = node;
@@ -388,10 +389,10 @@ int ref_node(void *ctx, void *node)
if (node != (void *) 1)
n->refcnt++;
- return 0;
+ return HUBBUB_OK;
}
-int unref_node(void *ctx, void *node)
+hubbub_error unref_node(void *ctx, void *node)
{
node_t *n = node;
@@ -409,10 +410,10 @@ int unref_node(void *ctx, void *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;
@@ -467,12 +468,12 @@ int append_child(void *ctx, void *parent, void *child, void **result)
ref_node(ctx, *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,
- void **result)
+hubbub_error insert_before(void *ctx, void *parent, void *child,
+ void *ref_child, void **result)
{
node_t *tparent = parent;
node_t *tchild = child;
@@ -515,10 +516,10 @@ int insert_before(void *ctx, void *parent, void *child, void *ref_child,
ref_node(ctx, *result);
- 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;
@@ -545,10 +546,10 @@ int remove_child(void *ctx, void *parent, void *child, void **result)
ref_node(ctx, *result);
- 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);
@@ -622,11 +623,11 @@ int clone_node(void *ctx, void *node, bool deep, void **result)
last = n;
}
- 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;
@@ -658,10 +659,10 @@ 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(element_only);
@@ -670,28 +671,28 @@ int get_parent(void *ctx, void *node, bool element_only, void **result)
if (*result != NULL)
ref_node(ctx, *result);
- 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;
@@ -722,15 +723,15 @@ 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;
}
diff --git a/test/tree.c b/test/tree.c
index 8738dcf..dee0893 100644
--- a/test/tree.c
+++ b/test/tree.c
@@ -29,25 +29,31 @@ static uintptr_t node_counter;
node_ref_alloc += NODE_REF_CHUNK; \
}
-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 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_doctype(void *ctx, const hubbub_doctype *doctype,
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 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 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,
@@ -181,7 +187,7 @@ int main(int argc, char **argv)
#undef DO_TEST
}
-int create_comment(void *ctx, const hubbub_string *data, void **result)
+hubbub_error create_comment(void *ctx, const hubbub_string *data, void **result)
{
printf("Creating (%" PRIuPTR ") [comment '%.*s']\n", ++node_counter,
(int) data->len, data->ptr);
@@ -195,10 +201,11 @@ int create_comment(void *ctx, const hubbub_string *data, void **result)
*result = (void *) node_counter;
- 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)
{
printf("Creating (%" PRIuPTR ") [doctype '%.*s']\n", ++node_counter,
(int) doctype->name.len, doctype->name.ptr);
@@ -220,10 +227,10 @@ int create_doctype(void *ctx, const hubbub_doctype *doctype, void **result)
*result = (void *) node_counter;
- 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)
{
printf("Creating (%" PRIuPTR ") [element '%.*s']\n", ++node_counter,
(int) tag->name.len, tag->name.ptr);
@@ -243,10 +250,10 @@ int create_element(void *ctx, const hubbub_tag *tag, void **result)
*result = (void *) node_counter;
- 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)
{
printf("Creating (%" PRIuPTR ") [text '%.*s']\n", ++node_counter,
(int) data->len, data->ptr);
@@ -260,41 +267,41 @@ int create_text(void *ctx, const hubbub_string *data, void **result)
*result = (void *) node_counter;
- return 0;
+ return HUBBUB_OK;
}
-int ref_node(void *ctx, void *node)
+hubbub_error ref_node(void *ctx, void *node)
{
UNUSED(ctx);
printf("Referencing %" PRIuPTR " (=%u)\n",
(uintptr_t) node, ++node_ref[(uintptr_t) node]);
- return 0;
+ return HUBBUB_OK;
}
-int unref_node(void *ctx, void *node)
+hubbub_error unref_node(void *ctx, void *node)
{
UNUSED(ctx);
printf("Unreferencing %" PRIuPTR " (=%u)\n",
(uintptr_t) node, --node_ref[(uintptr_t) 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)
{
printf("Appending %" PRIuPTR " to %" PRIuPTR "\n", (uintptr_t) child, (uintptr_t) parent);
ref_node(ctx, child);
*result = (void *) child;
- return 0;
+ return HUBBUB_OK;
}
-int insert_before(void *ctx, void *parent, void *child, void *ref_child,
- void **result)
+hubbub_error insert_before(void *ctx, void *parent, void *child,
+ void *ref_child, void **result)
{
printf("Inserting %" PRIuPTR " in %" PRIuPTR " before %" PRIuPTR "\n", (uintptr_t) child,
(uintptr_t) parent, (uintptr_t) ref_child);
@@ -302,20 +309,20 @@ int insert_before(void *ctx, void *parent, void *child, void *ref_child,
*result = (void *) 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)
{
printf("Removing %" PRIuPTR " from %" PRIuPTR "\n", (uintptr_t) child, (uintptr_t) parent);
ref_node(ctx, child);
*result = (void *) 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)
{
printf("%sCloning %" PRIuPTR " -> %" PRIuPTR "\n", deep ? "Deep-" : "",
(uintptr_t) node, ++node_counter);
@@ -327,20 +334,20 @@ int clone_node(void *ctx, void *node, bool deep, void **result)
*result = (void *) node_counter;
- return 0;
+ return HUBBUB_OK;
}
-int reparent_children(void *ctx, void *node, void *new_parent)
+hubbub_error reparent_children(void *ctx, void *node, void *new_parent)
{
UNUSED(ctx);
printf("Reparenting children of %" PRIuPTR " to %" PRIuPTR "\n",
(uintptr_t) node, (uintptr_t) new_parent);
- 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)
{
printf("Retrieving parent of %" PRIuPTR " (%s)\n", (uintptr_t) node,
element_only ? "element only" : "");
@@ -348,10 +355,10 @@ int get_parent(void *ctx, void *node, bool element_only, void **result)
ref_node(ctx, (void *) 1);
*result = (void *) 1;
- 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);
@@ -359,20 +366,20 @@ int has_children(void *ctx, void *node, bool *result)
*result = 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);
printf("Associating %" PRIuPTR " with form %" PRIuPTR "\n",
(uintptr_t) node, (uintptr_t) form);
- return 0;
+ return HUBBUB_OK;
}
-int add_attributes(void *ctx, void *node,
+hubbub_error add_attributes(void *ctx, void *node,
const hubbub_attribute *attributes, uint32_t n_attributes)
{
UNUSED(ctx);
@@ -388,15 +395,15 @@ int add_attributes(void *ctx, void *node,
assert(memchr(attr->value.ptr, 0xff, attr->value.len) == NULL);
}
- 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);
printf("Quirks mode = %u\n", mode);
- return 0;
+ return HUBBUB_OK;
}
diff --git a/test/tree2.c b/test/tree2.c
index 5da41ef..d6ae196 100644
--- a/test/tree2.c
+++ b/test/tree2.c
@@ -74,25 +74,25 @@ node_t *Document;
static void node_print(buf_t *buf, node_t *node, unsigned depth);
-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 void delete_node(node_t *node);
static void delete_attr(attr_t *attr);
@@ -358,7 +358,7 @@ int main(int argc, char **argv)
/*** 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);
@@ -371,10 +371,11 @@ 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);
@@ -400,10 +401,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);
@@ -440,10 +441,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);
@@ -456,10 +457,10 @@ 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)
{
node_t *n = node;
@@ -468,10 +469,10 @@ int ref_node(void *ctx, void *node)
if (node != (void *) 1)
n->refcnt++;
- return 0;
+ return HUBBUB_OK;
}
-int unref_node(void *ctx, void *node)
+hubbub_error unref_node(void *ctx, void *node)
{
node_t *n = node;
@@ -482,17 +483,19 @@ int unref_node(void *ctx, void *node)
n->refcnt--;
- printf("Unreferencing node %p (%d)\n", node, n->refcnt);
+ printf("Unreferencing node %p (%d) [%d : %s]\n", node,
+ n->refcnt, n->type,
+ n->type == ELEMENT ? n->data.element.name : "");
if (n->refcnt == 0 && n->parent == NULL) {
delete_node(n);
}
}
- 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;
@@ -546,12 +549,12 @@ int append_child(void *ctx, void *parent, void *child, void **result)
ref_node(ctx, *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,
- void **result)
+hubbub_error insert_before(void *ctx, void *parent, void *child,
+ void *ref_child, void **result)
{
node_t *tparent = parent;
node_t *tchild = child;
@@ -594,10 +597,10 @@ int insert_before(void *ctx, void *parent, void *child, void *ref_child,
ref_node(ctx, *result);
- 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;
@@ -624,10 +627,10 @@ int remove_child(void *ctx, void *parent, void *child, void **result)
ref_node(ctx, *result);
- 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);
@@ -701,11 +704,11 @@ int clone_node(void *ctx, void *node, bool deep, void **result)
last = n;
}
- 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;
@@ -737,10 +740,10 @@ 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(element_only);
@@ -749,28 +752,28 @@ int get_parent(void *ctx, void *node, bool element_only, void **result)
if (*result != NULL)
ref_node(ctx, *result);
- 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;
@@ -801,15 +804,15 @@ 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;
}