aboutsummaryrefslogtreecommitdiffstats
path: root/src/writer.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/writer.c')
-rw-r--r--src/writer.c9
1 files changed, 5 insertions, 4 deletions
diff --git a/src/writer.c b/src/writer.c
index b596638e..d7603d9a 100644
--- a/src/writer.c
+++ b/src/writer.c
@@ -142,12 +142,13 @@ supports_abbrev(const SerdWriter* writer)
return writer->syntax == SERD_TURTLE || writer->syntax == SERD_TRIG;
}
-static inline WriteContext*
-anon_stack_top(SerdWriter* writer)
+static inline const WriteContext*
+anon_stack_top(const SerdWriter* writer)
{
assert(!serd_stack_is_empty(&writer->anon_stack));
- return (WriteContext*)(writer->anon_stack.buf
- + writer->anon_stack.size - sizeof(WriteContext));
+ const char* const end = writer->anon_stack.buf + writer->anon_stack.size;
+ const void* const top = end - sizeof(WriteContext);
+ return (const WriteContext*)top;
}
static inline SerdNode*