aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorDavid Robillard <d@drobilla.net>2021-08-13 17:07:23 -0400
committerDavid Robillard <d@drobilla.net>2022-01-28 21:57:07 -0500
commit776a198a686b4eeb824dc520ed12f169ac7e1e65 (patch)
tree21daa2f161dedc250a823746a9d7357630253cd1
parent196db2ef0cd44c3fb542b86be7929bd01d83e138 (diff)
downloadserd-776a198a686b4eeb824dc520ed12f169ac7e1e65.tar.gz
serd-776a198a686b4eeb824dc520ed12f169ac7e1e65.tar.bz2
serd-776a198a686b4eeb824dc520ed12f169ac7e1e65.zip
Remove SERD_NO_INLINE_OBJECTS
This seems like pointless complexity now, since it's easy to just write simply ordered statements yourself.
-rw-r--r--include/serd/serd.h3
-rw-r--r--src/describe.c27
-rw-r--r--test/test_model.c5
3 files changed, 13 insertions, 22 deletions
diff --git a/include/serd/serd.h b/include/serd/serd.h
index 07f6b9f5..daf903a2 100644
--- a/include/serd/serd.h
+++ b/include/serd/serd.h
@@ -2678,8 +2678,7 @@ serd_cursor_free(SerdCursor* SERD_NULLABLE cursor);
/// Flags that control the style of a model serialisation
typedef enum {
- SERD_NO_INLINE_OBJECTS = 1u << 0u, ///< Disable object inlining
- SERD_NO_TYPE_FIRST = 1u << 1u ///< Disable writing rdf:type ("a") first
+ SERD_NO_TYPE_FIRST = 1u << 0u ///< Disable writing rdf:type ("a") first
} SerdDescribeFlag;
/// Bitwise OR of SerdDescribeFlag values
diff --git a/src/describe.c b/src/describe.c
index 9328f261..4a087222 100644
--- a/src/describe.c
+++ b/src/describe.c
@@ -289,31 +289,20 @@ serd_describe_range(const SerdCursor* const range,
const SerdSink* sink,
const SerdDescribeFlags flags)
{
- assert(sink);
-
- SerdStatus st = SERD_SUCCESS;
-
if (serd_cursor_is_end(range)) {
- return st;
+ return SERD_SUCCESS;
}
- SerdCursor copy = *range;
+ assert(sink);
- if (flags & SERD_NO_INLINE_OBJECTS) {
- const SerdStatement* statement = NULL;
- while (!st && (statement = serd_cursor_get(&copy))) {
- if (!(st = serd_sink_write_statement(sink, 0, statement))) {
- st = serd_cursor_advance(&copy);
- }
- }
- } else {
- DescribeContext ctx = {
- range->model, sink, zix_hash_new(identity, ptr_hash, ptr_equals), flags};
+ SerdStatus st = SERD_SUCCESS;
+ SerdCursor copy = *range;
+ ZixHash* const list_subjects = zix_hash_new(identity, ptr_hash, ptr_equals);
+ DescribeContext ctx = {range->model, sink, list_subjects, flags};
- st = write_pretty_range(&ctx, 0, &copy, NULL, (flags & SERD_NO_TYPE_FIRST));
+ st = write_pretty_range(&ctx, 0, &copy, NULL, (flags & SERD_NO_TYPE_FIRST));
- zix_hash_free(ctx.list_subjects);
- }
+ zix_hash_free(list_subjects);
return st;
}
diff --git a/test/test_model.c b/test/test_model.c
index d5b5eb8c..acefe05f 100644
--- a/test/test_model.c
+++ b/test/test_model.c
@@ -1058,7 +1058,10 @@ test_write_flat_range(SerdWorld* world, const unsigned n_quads)
SerdWriter* writer = serd_writer_new(world, SERD_TURTLE, 0, env, out);
SerdCursor* all = serd_model_begin(model);
- serd_describe_range(all, serd_writer_sink(writer), SERD_NO_INLINE_OBJECTS);
+ for (const SerdStatement* t = NULL; (t = serd_cursor_get(all));
+ serd_cursor_advance(all)) {
+ serd_sink_write_statement(serd_writer_sink(writer), 0u, t);
+ }
serd_cursor_free(all);
serd_writer_finish(writer);