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 --- include/kit.inl.h | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) (limited to 'include') diff --git a/include/kit.inl.h b/include/kit.inl.h index 9752919..7b7407d 100644 --- a/include/kit.inl.h +++ b/include/kit.inl.h @@ -2088,7 +2088,9 @@ void *kit_alloc_dispatch(kit_allocator_t *alloc, i32 request, return kit_allocate_default_(request, size, previous_size, 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:; } @@ -4341,6 +4343,7 @@ static ib_t kit_xml_parse_text_(ib_t begin) { if (next_text.status == KIT_OK && next_text.data.size > 0) { 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 @@ -4438,6 +4441,7 @@ static kit_xml_intermediate_t kit_xml_parse_buf_( if (last.status == KIT_OK) { 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); @@ -4499,6 +4503,7 @@ static kit_xml_intermediate_t kit_xml_parse_buf_( if (last.status == KIT_OK) { 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