From 0685e317c1708fa2cdcf6bd0943cc7a9208adaf2 Mon Sep 17 00:00:00 2001 From: John Mark Bell Date: Wed, 25 Mar 2009 17:02:39 +0000 Subject: Make testcases compile in release mode svn path=/trunk/hubbub/; revision=6878 --- test/tree-buf.c | 27 +++++++++++++++++++++++++++ test/tree.c | 2 ++ test/tree2.c | 28 +++++++++++++++++++++++++++- 3 files changed, 56 insertions(+), 1 deletion(-) diff --git a/test/tree-buf.c b/test/tree-buf.c index 2c623e1..658e8e8 100644 --- a/test/tree-buf.c +++ b/test/tree-buf.c @@ -282,6 +282,8 @@ int create_comment(void *ctx, const hubbub_string *data, void **result) { node_t *node = calloc(1, sizeof *node); + UNUSED(ctx); + node->type = COMMENT; node->data.content = strndup((const char *) data->ptr, data->len); node->refcnt = 1; @@ -296,6 +298,8 @@ int create_doctype(void *ctx, const hubbub_doctype *doctype, void **result) { node_t *node = calloc(1, sizeof *node); + UNUSED(ctx); + node->type = DOCTYPE; node->data.doctype.name = strndup( (const char *) doctype->name.ptr, @@ -323,6 +327,8 @@ int create_element(void *ctx, const hubbub_tag *tag, void **result) { node_t *node = calloc(1, sizeof *node); + UNUSED(ctx); + assert(tag->ns < NUM_NAMESPACES); node->type = ELEMENT; @@ -361,6 +367,8 @@ int create_text(void *ctx, const hubbub_string *data, void **result) { node_t *node = calloc(1, sizeof *node); + UNUSED(ctx); + node->type = CHARACTER; node->data.content = strndup((const char *) data->ptr, data->len); node->refcnt = 1; @@ -375,6 +383,8 @@ int ref_node(void *ctx, void *node) { node_t *n = node; + UNUSED(ctx); + if (node != (void *) 1) n->refcnt++; @@ -385,6 +395,8 @@ int unref_node(void *ctx, void *node) { node_t *n = node; + UNUSED(ctx); + if (n != (void *) 1) { assert(n->refcnt > 0); @@ -622,6 +634,8 @@ int reparent_children(void *ctx, void *node, void *new_parent) node_t *insert; node_t *kids; + UNUSED(ctx); + kids = old_parent->child; if (!kids) return 0; @@ -649,6 +663,8 @@ int reparent_children(void *ctx, void *node, void *new_parent) int get_parent(void *ctx, void *node, bool element_only, void **result) { + UNUSED(element_only); + *result = ((node_t *)node)->parent; if (*result != NULL) @@ -659,6 +675,8 @@ int get_parent(void *ctx, void *node, bool element_only, void **result) int has_children(void *ctx, void *node, bool *result) { + UNUSED(ctx); + *result = ((node_t *)node)->child ? true : false; return 0; @@ -666,6 +684,10 @@ int has_children(void *ctx, void *node, bool *result) int form_associate(void *ctx, void *form, void *node) { + UNUSED(ctx); + UNUSED(form); + UNUSED(node); + return 0; } @@ -675,6 +697,8 @@ int add_attributes(void *ctx, void *vnode, node_t *node = vnode; size_t old_elems = node->data.element.n_attrs; + UNUSED(ctx); + node->data.element.n_attrs += n_attributes; node->data.element.attrs = realloc(node->data.element.attrs, @@ -703,6 +727,9 @@ int add_attributes(void *ctx, void *vnode, int set_quirks_mode(void *ctx, hubbub_quirks_mode mode) { + UNUSED(ctx); + UNUSED(mode); + return 0; } diff --git a/test/tree.c b/test/tree.c index 8a5a5b1..8738dcf 100644 --- a/test/tree.c +++ b/test/tree.c @@ -88,6 +88,8 @@ static int run_test(int argc, char **argv, unsigned int CHUNK_SIZE) hubbub_charset_source cssource; bool passed = true; + UNUSED(argc); + node_ref = calloc(NODE_REF_CHUNK, sizeof(uint16_t)); if (node_ref == NULL) { printf("Failed allocating node_ref\n"); diff --git a/test/tree2.c b/test/tree2.c index 3544ff4..5da41ef 100644 --- a/test/tree2.c +++ b/test/tree2.c @@ -362,6 +362,8 @@ int create_comment(void *ctx, const hubbub_string *data, void **result) { node_t *node = calloc(1, sizeof *node); + UNUSED(ctx); + node->type = COMMENT; node->data.content = strndup((const char *) data->ptr, data->len); node->refcnt = 1; @@ -376,6 +378,8 @@ int create_doctype(void *ctx, const hubbub_doctype *doctype, void **result) { node_t *node = calloc(1, sizeof *node); + UNUSED(ctx); + node->type = DOCTYPE; node->data.doctype.name = strndup( (const char *) doctype->name.ptr, @@ -403,6 +407,8 @@ int create_element(void *ctx, const hubbub_tag *tag, void **result) { node_t *node = calloc(1, sizeof *node); + UNUSED(ctx); + assert(tag->ns < NUM_NAMESPACES); node->type = ELEMENT; @@ -441,6 +447,8 @@ int create_text(void *ctx, const hubbub_string *data, void **result) { node_t *node = calloc(1, sizeof *node); + UNUSED(ctx); + node->type = CHARACTER; node->data.content = strndup((const char *) data->ptr, data->len); node->refcnt = 1; @@ -455,6 +463,8 @@ int ref_node(void *ctx, void *node) { node_t *n = node; + UNUSED(ctx); + if (node != (void *) 1) n->refcnt++; @@ -465,6 +475,8 @@ int unref_node(void *ctx, void *node) { node_t *n = node; + UNUSED(ctx); + if (n != (void *) 1) { assert(n->refcnt > 0); @@ -484,7 +496,6 @@ int append_child(void *ctx, void *parent, void *child, void **result) { node_t *tparent = parent; node_t *tchild = child; - node_t *insert = NULL; tchild->next = tchild->prev = NULL; @@ -702,6 +713,8 @@ int reparent_children(void *ctx, void *node, void *new_parent) node_t *insert; node_t *kids; + UNUSED(ctx); + kids = old_parent->child; if (!kids) return 0; @@ -729,6 +742,8 @@ int reparent_children(void *ctx, void *node, void *new_parent) int get_parent(void *ctx, void *node, bool element_only, void **result) { + UNUSED(element_only); + *result = ((node_t *)node)->parent; if (*result != NULL) @@ -739,6 +754,8 @@ int get_parent(void *ctx, void *node, bool element_only, void **result) int has_children(void *ctx, void *node, bool *result) { + UNUSED(ctx); + *result = ((node_t *)node)->child ? true : false; return 0; @@ -746,6 +763,10 @@ int has_children(void *ctx, void *node, bool *result) int form_associate(void *ctx, void *form, void *node) { + UNUSED(ctx); + UNUSED(form); + UNUSED(node); + return 0; } @@ -755,6 +776,8 @@ int add_attributes(void *ctx, void *vnode, node_t *node = vnode; size_t old_elems = node->data.element.n_attrs; + UNUSED(ctx); + node->data.element.n_attrs += n_attributes; node->data.element.attrs = realloc(node->data.element.attrs, @@ -783,6 +806,9 @@ int add_attributes(void *ctx, void *vnode, int set_quirks_mode(void *ctx, hubbub_quirks_mode mode) { + UNUSED(ctx); + UNUSED(mode); + return 0; } -- cgit v1.2.3