Clean up memory management

This commit is contained in:
Zachary Levy
2026-04-20 20:27:40 -07:00
parent 64de816647
commit f85187eff3
4 changed files with 213 additions and 22 deletions

View File

@@ -139,6 +139,7 @@ text :: proc(
temp_allocator := context.temp_allocator,
) {
c_str := strings.clone_to_cstring(text_string, temp_allocator)
defer delete(c_str, temp_allocator)
sdl_text: ^sdl_ttf.Text
cached := false
@@ -180,6 +181,7 @@ measure_text :: proc(
allocator := context.temp_allocator,
) -> [2]f32 {
c_str := strings.clone_to_cstring(text_string, allocator)
defer delete(c_str, allocator)
width, height: c.int
if !sdl_ttf.GetStringSize(get_font(font_id, font_size), c_str, 0, &width, &height) {
log.panicf("Failed to measure text: %s", sdl.GetError())