aboutsummaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/node.c2
-rw-r--r--src/reader.c1
-rw-r--r--src/stack.h4
3 files changed, 5 insertions, 2 deletions
diff --git a/src/node.c b/src/node.c
index b31cc01c..f9cb5cc2 100644
--- a/src/node.c
+++ b/src/node.c
@@ -345,7 +345,7 @@ serd_node_copy(const SerdNode* node)
const size_t size = serd_node_total_size(node);
SerdNode* copy = (SerdNode*)serd_calloc_aligned(size + 3, serd_node_align);
- assert((intptr_t)node % serd_node_align == 0);
+ assert((uintptr_t)copy % serd_node_align == 0);
memcpy(copy, node, size);
return copy;
diff --git a/src/reader.c b/src/reader.c
index ca16d2e7..20903c7f 100644
--- a/src/reader.c
+++ b/src/reader.c
@@ -90,6 +90,7 @@ push_node_padded(SerdReader* reader, size_t maxlen,
void* mem = serd_stack_push_aligned(
&reader->stack, sizeof(SerdNode) + maxlen + 1, sizeof(SerdNode));
+ assert((uintptr_t)mem % sizeof(SerdNode) == 0);
if (!mem) {
return NULL;
}
diff --git a/src/stack.h b/src/stack.h
index 01e45f52..3610d0c3 100644
--- a/src/stack.h
+++ b/src/stack.h
@@ -17,6 +17,8 @@
#ifndef SERD_STACK_H
#define SERD_STACK_H
+#include "system.h"
+
#include <assert.h>
#include <stdbool.h>
#include <stddef.h>
@@ -38,7 +40,7 @@ static inline SerdStack
serd_stack_new(size_t size)
{
SerdStack stack;
- stack.buf = (char*)calloc(size, 1);
+ stack.buf = (char*)serd_calloc_aligned(size, sizeof(SerdNode));
stack.buf_size = size;
stack.size = SERD_STACK_BOTTOM;
return stack;