From cec24f4b4d270093065141e68ddc0fa2b88b2454 Mon Sep 17 00:00:00 2001 From: David Robillard Date: Mon, 7 Jan 2019 19:53:43 +0100 Subject: Fix cast alignment warning --- src/writer.c | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) (limited to 'src/writer.c') 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* -- cgit v1.2.1