aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorDavid Robillard <d@drobilla.net>2019-01-07 19:53:43 +0100
committerDavid Robillard <d@drobilla.net>2019-04-13 19:48:23 +0200
commitcec24f4b4d270093065141e68ddc0fa2b88b2454 (patch)
treeebeab72f20e23eb938f86ef55f98cb22e7320452
parent99cae6357340849c6cd3a48c0d23533389415079 (diff)
downloadserd-cec24f4b4d270093065141e68ddc0fa2b88b2454.tar.gz
serd-cec24f4b4d270093065141e68ddc0fa2b88b2454.tar.bz2
serd-cec24f4b4d270093065141e68ddc0fa2b88b2454.zip
Fix cast alignment warning
-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*