From ed9f20507cb3199827feb203159656e233372e44 Mon Sep 17 00:00:00 2001 From: Mitya Selivanov Date: Fri, 22 Sep 2023 21:23:29 +0200 Subject: GL registry parsing --- source/kit/allocator.c | 4 +++- source/kit/xml.c | 3 +++ 2 files changed, 6 insertions(+), 1 deletion(-) (limited to 'source') 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); -- cgit v1.2.3