From d91b3c9ec59976c40742c852d25dccf67b445e61 Mon Sep 17 00:00:00 2001 From: David Robillard Date: Wed, 12 Jan 2022 20:41:41 -0500 Subject: Use SerdNodes instead of manual memory management in tests --- test/test_reader.c | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) (limited to 'test/test_reader.c') diff --git a/test/test_reader.c b/test/test_reader.c index 095f736e..6b807d89 100644 --- a/test/test_reader.c +++ b/test/test_reader.c @@ -463,7 +463,8 @@ check_cursor(void* handle, const SerdEvent* event) static void test_error_cursor(void) { - SerdWorld* world = serd_world_new(NULL); + SerdWorld* const world = serd_world_new(NULL); + SerdNodes* const nodes = serd_world_nodes(world); bool called = false; SerdSink* sink = serd_sink_new(world, &called, check_cursor, NULL); SerdEnv* const env = serd_env_new(world, SERD_EMPTY_STRING()); @@ -477,9 +478,11 @@ test_error_cursor(void) " " " ."; - SerdNode* const string_name = serd_new_string(NULL, SERD_STRING("string")); - const char* position = string; - SerdInputStream in = serd_open_input_string(&position); + const SerdNode* const string_name = + serd_nodes_string(nodes, SERD_STRING("string")); + + const char* position = string; + SerdInputStream in = serd_open_input_string(&position); SerdStatus st = serd_reader_start(reader, &in, string_name, 1); assert(!st); @@ -488,7 +491,6 @@ test_error_cursor(void) assert(called); assert(!serd_close_input(&in)); - serd_node_free(NULL, string_name); serd_reader_free(reader); serd_env_free(env); serd_sink_free(sink); -- cgit v1.2.1