diff options
author | David Robillard <d@drobilla.net> | 2022-01-12 20:41:41 -0500 |
---|---|---|
committer | David Robillard <d@drobilla.net> | 2022-01-28 21:57:29 -0500 |
commit | d91b3c9ec59976c40742c852d25dccf67b445e61 (patch) | |
tree | 0984d9b9a0890b6f4d5aa3a6278ac99bff8b4b91 /test/test_reader.c | |
parent | fd735236cca8af5364f98e5587b2984b3d798378 (diff) | |
download | serd-d91b3c9ec59976c40742c852d25dccf67b445e61.tar.gz serd-d91b3c9ec59976c40742c852d25dccf67b445e61.tar.bz2 serd-d91b3c9ec59976c40742c852d25dccf67b445e61.zip |
Use SerdNodes instead of manual memory management in tests
Diffstat (limited to 'test/test_reader.c')
-rw-r--r-- | test/test_reader.c | 12 |
1 files changed, 7 insertions, 5 deletions
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) "<http://example.org/s> <http://example.org/p> " "<http://example.org/o> ."; - 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); |