diff options
author | David Robillard <d@drobilla.net> | 2018-12-26 20:04:27 -0500 |
---|---|---|
committer | David Robillard <d@drobilla.net> | 2020-06-21 18:12:04 +0200 |
commit | a8fade27de9691ce329894fcb4e63f52a1ec719c (patch) | |
tree | c9405e5dfc0ba80723c244402bfb8b8c1c910011 | |
parent | 6944e607ec8f068d061476e26415868d12081d79 (diff) | |
download | serd-a8fade27de9691ce329894fcb4e63f52a1ec719c.tar.gz serd-a8fade27de9691ce329894fcb4e63f52a1ec719c.tar.bz2 serd-a8fade27de9691ce329894fcb4e63f52a1ec719c.zip |
Remove serd_reader_set_default_graph()
-rw-r--r-- | serd/serd.h | 12 | ||||
-rw-r--r-- | src/reader.c | 12 | ||||
-rw-r--r-- | src/reader.h | 1 | ||||
-rw-r--r-- | tests/serd_test.c | 11 |
4 files changed, 2 insertions, 34 deletions
diff --git a/serd/serd.h b/serd/serd.h index 56534571..50feb039 100644 --- a/serd/serd.h +++ b/serd/serd.h @@ -1104,18 +1104,6 @@ serd_reader_add_blank_prefix(SerdReader* reader, const char* prefix); /** - Set the URI of the default graph. - - If this is set, the reader will emit quads with the graph set to the given - node for any statements that are not in a named graph (which is currently - all of them since Serd currently does not support any graph syntaxes). -*/ -SERD_API -void -serd_reader_set_default_graph(SerdReader* reader, - const SerdNode* graph); - -/** Prepare to read from the file at a local file `uri`. */ SERD_API diff --git a/src/reader.c b/src/reader.c index 065e1c51..c7e0feab 100644 --- a/src/reader.c +++ b/src/reader.c @@ -120,8 +120,6 @@ emit_statement(SerdReader* reader, ReadContext ctx, SerdNode* o) SerdNode* graph = ctx.graph; if (!reader->sink->statement) { return SERD_SUCCESS; - } else if (!graph && reader->default_graph) { - graph = reader->default_graph; } /* Zero the pad of the object node on the top of the stack. Lower nodes @@ -171,7 +169,6 @@ serd_reader_new(SerdWorld* world, me->world = world; me->sink = sink; - me->default_graph = NULL; me->stack = serd_stack_new(stack_size); me->syntax = syntax; me->next_id = 1; @@ -194,7 +191,6 @@ void serd_reader_free(SerdReader* reader) { serd_reader_finish(reader); - serd_node_free(reader->default_graph); #ifdef SERD_STACK_CHECK free(reader->allocs); @@ -218,14 +214,6 @@ serd_reader_add_blank_prefix(SerdReader* reader, } } -void -serd_reader_set_default_graph(SerdReader* reader, - const SerdNode* graph) -{ - serd_node_free(reader->default_graph); - reader->default_graph = serd_node_copy(graph); -} - static SerdStatus skip_bom(SerdReader* me) { diff --git a/src/reader.h b/src/reader.h index 736281d1..869ac21d 100644 --- a/src/reader.h +++ b/src/reader.h @@ -57,7 +57,6 @@ struct SerdReaderImpl { SerdNode* rdf_first; SerdNode* rdf_rest; SerdNode* rdf_nil; - SerdNode* default_graph; SerdByteSource source; SerdStack stack; SerdSyntax syntax; diff --git a/tests/serd_test.c b/tests/serd_test.c index f7e7cbef..d5b8d33b 100644 --- a/tests/serd_test.c +++ b/tests/serd_test.c @@ -61,8 +61,7 @@ count_prefixes(void* handle, const SerdNode* name, const SerdNode* uri) } typedef struct { - int n_statements; - const SerdNode* graph; + int n_statements; } ReaderTest; static SerdStatus @@ -75,7 +74,6 @@ test_sink(void* handle, ReaderTest* rt = (ReaderTest*)handle; ++rt->n_statements; - rt->graph = serd_statement_get_graph(statement); return SERD_SUCCESS; } @@ -728,18 +726,15 @@ test_reader(const char* path) { SerdWorld* world = serd_world_new(); - ReaderTest rt = { 0, NULL }; + ReaderTest rt = { 0 }; SerdSink* sink = serd_sink_new(&rt); serd_sink_set_statement_func(sink, test_sink); SerdReader* reader = serd_reader_new(world, SERD_TURTLE, sink, 4096); assert(reader); - SerdNode* g = serd_new_uri("http://example.org/"); - serd_reader_set_default_graph(reader, g); serd_reader_add_blank_prefix(reader, "tmp"); serd_reader_add_blank_prefix(reader, NULL); - serd_node_free(g); assert(serd_reader_start_file(reader, "http://notafile", false)); assert(serd_reader_start_file(reader, "file://invalid", false)); @@ -748,8 +743,6 @@ test_reader(const char* path) assert(!serd_reader_start_file(reader, path, true)); assert(!serd_reader_read_document(reader)); assert(rt.n_statements == 13); - assert(rt.graph && serd_node_get_string(rt.graph) && - !strcmp(serd_node_get_string(rt.graph), "http://example.org/")); serd_reader_finish(reader); serd_reader_free(reader); |