summaryrefslogtreecommitdiff
path: root/source
diff options
context:
space:
mode:
authorMitya Selivanov <automainint@guattari.tech>2023-09-22 21:23:29 +0200
committerMitya Selivanov <automainint@guattari.tech>2023-09-22 21:23:29 +0200
commited9f20507cb3199827feb203159656e233372e44 (patch)
tree81408dbc7a493f71650669b7138a3352fe571a27 /source
parent242b87209b778d033d1da828ae9ec47170c17f38 (diff)
downloadkit-ed9f20507cb3199827feb203159656e233372e44.zip
GL registry parsing
Diffstat (limited to 'source')
-rw-r--r--source/kit/allocator.c4
-rw-r--r--source/kit/xml.c3
2 files changed, 6 insertions, 1 deletions
diff --git a/source/kit/allocator.c b/source/kit/allocator.c
index 920da5a..e1446ac 100644
--- a/source/kit/allocator.c
+++ b/source/kit/allocator.c
@@ -173,7 +173,9 @@ void *kit_alloc_dispatch(kit_allocator_t *alloc, i32 request,
pointer);
case KIT_ALLOC_TYPE_BUFFER:
- return kit_allocate_from_buffer_(alloc, request, size,
+ return kit_allocate_from_buffer_(alloc, request,
+ // alignment
+ ((size + 7) / 8) * 8,
previous_size, pointer);
default:;
diff --git a/source/kit/xml.c b/source/kit/xml.c
index 1c8e9f6..a9d18e3 100644
--- a/source/kit/xml.c
+++ b/source/kit/xml.c
@@ -69,6 +69,7 @@ static ib_t kit_xml_parse_text_(ib_t begin) {
i64 n = text.data.size;
DA_RESIZE(text.data, n + next_text.data.size);
+ assert(text.data.size == n + next_text.data.size);
if (text.data.size != n + next_text.data.size)
next_text.status = KIT_ERROR_BAD_ALLOC;
else
@@ -200,6 +201,7 @@ static kit_xml_intermediate_t kit_xml_parse_buf_(
i64 n = tag.properties.size;
DA_RESIZE(tag.properties, n + 1);
+ assert(tag.properties.size == n + 1);
if (tag.properties.size != n + 1) {
last.status = KIT_ERROR_BAD_ALLOC;
DA_DESTROY(tag.properties);
@@ -277,6 +279,7 @@ static kit_xml_intermediate_t kit_xml_parse_buf_(
i64 n = res.tags.size;
DA_RESIZE(res.tags, n + 1);
+ assert(res.tags.size == n + 1);
if (res.tags.size != n + 1) {
last.status = KIT_ERROR_BAD_ALLOC;
xml_destroy(&tag);