diff options
author | David Robillard <d@drobilla.net> | 2021-08-12 22:33:47 -0400 |
---|---|---|
committer | David Robillard <d@drobilla.net> | 2022-01-28 21:57:07 -0500 |
commit | 196db2ef0cd44c3fb542b86be7929bd01d83e138 (patch) | |
tree | 97ad345394e394c0d42b43fcf3d464794f719ccb /src/cursor.c | |
parent | fdf837b4b3baffc65e429c2e6ecc2e764bfed0ac (diff) | |
download | serd-196db2ef0cd44c3fb542b86be7929bd01d83e138.tar.gz serd-196db2ef0cd44c3fb542b86be7929bd01d83e138.tar.bz2 serd-196db2ef0cd44c3fb542b86be7929bd01d83e138.zip |
Put rdf:type properties first when pretty-printing
This is a common convention in Turtle and TriG because the special "a" syntax
for rdf type as the first property looks nice, makes things easier to read, and
can be useful for streaming implementations because the type of the instance is
known before reading its properties.
Also significantly clean up the pretty-printing implementation in the process.
Diffstat (limited to 'src/cursor.c')
-rw-r--r-- | src/cursor.c | 9 |
1 files changed, 4 insertions, 5 deletions
diff --git a/src/cursor.c b/src/cursor.c index 4213476e..650ac771 100644 --- a/src/cursor.c +++ b/src/cursor.c @@ -146,11 +146,10 @@ serd_cursor_copy(const SerdCursor* const cursor) const SerdStatement* serd_cursor_get(const SerdCursor* const cursor) { - assert(cursor); - - return ((!zix_btree_iter_is_end(cursor->iter) && check_version(cursor)) - ? (const SerdStatement*)zix_btree_get(cursor->iter) - : NULL); + return ( + (cursor && !zix_btree_iter_is_end(cursor->iter) && check_version(cursor)) + ? (const SerdStatement*)zix_btree_get(cursor->iter) + : NULL); } SerdStatus |