From 528795a5daf767532a42b492db29deeadebcb249 Mon Sep 17 00:00:00 2001 From: Michael Drake Date: Sat, 14 Dec 2013 23:15:34 +0000 Subject: Remove client allocation function and update for new lpu API. --- test/parser.c | 10 +--------- test/tokeniser.c | 12 ++---------- test/tokeniser2.c | 12 ++---------- test/tokeniser3.c | 12 ++---------- test/tree-buf.c | 21 +-------------------- test/tree.c | 10 +--------- test/tree2.c | 21 +-------------------- 7 files changed, 10 insertions(+), 88 deletions(-) (limited to 'test') diff --git a/test/parser.c b/test/parser.c index 93bdad2..6b0db45 100644 --- a/test/parser.c +++ b/test/parser.c @@ -12,13 +12,6 @@ static hubbub_error token_handler(const hubbub_token *token, void *pw); -static void *myrealloc(void *ptr, size_t len, void *pw) -{ - UNUSED(pw); - - return realloc(ptr, len); -} - static int run_test(int argc, char **argv, unsigned int CHUNK_SIZE) { hubbub_parser *parser; @@ -31,8 +24,7 @@ static int run_test(int argc, char **argv, unsigned int CHUNK_SIZE) UNUSED(argc); - assert(hubbub_parser_create("UTF-8", false, myrealloc, NULL, &parser) == - HUBBUB_OK); + assert(hubbub_parser_create("UTF-8", false, &parser) == HUBBUB_OK); params.token_handler.handler = token_handler; params.token_handler.pw = NULL; diff --git a/test/tokeniser.c b/test/tokeniser.c index 717e34e..1cac0af 100644 --- a/test/tokeniser.c +++ b/test/tokeniser.c @@ -13,13 +13,6 @@ static hubbub_error token_handler(const hubbub_token *token, void *pw); -static void *myrealloc(void *ptr, size_t len, void *pw) -{ - UNUSED(pw); - - return realloc(ptr, len); -} - int main(int argc, char **argv) { parserutils_inputstream *stream; @@ -36,10 +29,9 @@ int main(int argc, char **argv) } assert(parserutils_inputstream_create("UTF-8", 0, NULL, - myrealloc, NULL, &stream) == PARSERUTILS_OK); + &stream) == PARSERUTILS_OK); - assert(hubbub_tokeniser_create(stream, myrealloc, NULL, &tok) == - HUBBUB_OK); + assert(hubbub_tokeniser_create(stream, &tok) == HUBBUB_OK); params.token_handler.handler = token_handler; params.token_handler.pw = NULL; diff --git a/test/tokeniser2.c b/test/tokeniser2.c index 443b71d..c8ab9c0 100644 --- a/test/tokeniser2.c +++ b/test/tokeniser2.c @@ -32,13 +32,6 @@ typedef struct context { static void run_test(context *ctx); static hubbub_error token_handler(const hubbub_token *token, void *pw); -static void *myrealloc(void *ptr, size_t len, void *pw) -{ - UNUSED(pw); - - return realloc(ptr, len); -} - int main(int argc, char **argv) { struct json_object *json; @@ -135,10 +128,9 @@ void run_test(context *ctx) ctx->char_off = 0; assert(parserutils_inputstream_create("UTF-8", 0, NULL, - myrealloc, NULL, &stream) == PARSERUTILS_OK); + &stream) == PARSERUTILS_OK); - assert(hubbub_tokeniser_create(stream, myrealloc, NULL, &tok) == - HUBBUB_OK); + assert(hubbub_tokeniser_create(stream, &tok) == HUBBUB_OK); if (ctx->last_start_tag != NULL) { /* Fake up a start tag, in PCDATA state */ diff --git a/test/tokeniser3.c b/test/tokeniser3.c index 9f0f84e..949ddd0 100644 --- a/test/tokeniser3.c +++ b/test/tokeniser3.c @@ -30,13 +30,6 @@ typedef struct context { static void run_test(context *ctx); static hubbub_error token_handler(const hubbub_token *token, void *pw); -static void *myrealloc(void *ptr, size_t len, void *pw) -{ - UNUSED(pw); - - return realloc(ptr, len); -} - int main(int argc, char **argv) { struct json_object *json; @@ -133,10 +126,9 @@ void run_test(context *ctx) ctx->char_off = 0; assert(parserutils_inputstream_create("UTF-8", 0, NULL, - myrealloc, NULL, &stream) == PARSERUTILS_OK); + &stream) == PARSERUTILS_OK); - assert(hubbub_tokeniser_create(stream, myrealloc, NULL, &tok) == - HUBBUB_OK); + assert(hubbub_tokeniser_create(stream, &tok) == HUBBUB_OK); if (ctx->last_start_tag != NULL) { /* Fake up a start tag, in PCDATA state */ diff --git a/test/tree-buf.c b/test/tree-buf.c index 9814932..83447a2 100644 --- a/test/tree-buf.c +++ b/test/tree-buf.c @@ -120,24 +120,6 @@ static hubbub_tree_handler tree_handler = { NULL }; -static void *myrealloc(void *ptr, size_t len, void *pw) -{ - void *ret; - - UNUSED(pw); - - /* A half-arsed attempt at filling freshly allocated space with junk. */ - if (ptr == NULL) { - ret = malloc(len); - if (ret != NULL) - memset(ret, 0xdf, len); - } else { - ret = realloc(ptr, len); - } - - return ret; -} - /* * Create, initialise, and return, a parser instance. @@ -147,8 +129,7 @@ static hubbub_parser *setup_parser(void) hubbub_parser *parser; hubbub_parser_optparams params; - 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, diff --git a/test/tree.c b/test/tree.c index 9896df8..14b76a3 100644 --- a/test/tree.c +++ b/test/tree.c @@ -78,13 +78,6 @@ static hubbub_tree_handler tree_handler = { NULL }; -static void *myrealloc(void *ptr, size_t len, void *pw) -{ - UNUSED(pw); - - return realloc(ptr, len); -} - static int run_test(int argc, char **argv, unsigned int CHUNK_SIZE) { hubbub_parser *parser; @@ -106,8 +99,7 @@ static int run_test(int argc, char **argv, unsigned int CHUNK_SIZE) } node_ref_alloc = NODE_REF_CHUNK; - 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, diff --git a/test/tree2.c b/test/tree2.c index 15f75db..d5d4c72 100644 --- a/test/tree2.c +++ b/test/tree2.c @@ -120,24 +120,6 @@ static hubbub_tree_handler tree_handler = { NULL }; -static void *myrealloc(void *ptr, size_t len, void *pw) -{ - void *ret; - - UNUSED(pw); - - /* A half-arsed attempt at filling freshly allocated space with junk. */ - if (ptr == NULL) { - ret = malloc(len); - if (ret != NULL) - memset(ret, 0xdf, len); - } else { - ret = realloc(ptr, len); - } - - return ret; -} - /* * Create, initialise, and return, a parser instance. @@ -147,8 +129,7 @@ static hubbub_parser *setup_parser(void) hubbub_parser *parser; hubbub_parser_optparams params; - 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, -- cgit v1.2.3