Mercurial
diff mrjunejune/create_html_from_md.c @ 255:5ec271d612ae
[dowa] Enforce arena ownership
Co-authored-by: Copilot <[email protected]>
| author | MrJuneJune <me@mrjunejune.com> |
|---|---|
| date | Tue, 04 Aug 2026 15:12:18 -0700 |
| parents | 295ac2e5ec00 |
| children |
line wrap: on
line diff
--- a/mrjunejune/create_html_from_md.c Tue Aug 04 15:12:09 2026 -0700 +++ b/mrjunejune/create_html_from_md.c Tue Aug 04 15:12:18 2026 -0700 @@ -126,10 +126,9 @@ Blog_Metadata meta = Parse_Blog_Frontmatter(md_file); char *md = markdown_to_html(meta.content); char *ssr_body = Dowa_Arena_Allocate(arena, buffer_sizes); - char *final_body = Dowa_Arena_Allocate(arena, buffer_sizes); snprintf(ssr_body, buffer_sizes, BLOG_HTML, meta.description, meta.title, md); + markdown_free(md); - int open_flags = O_RDWR | O_CREAT | O_EXCL; size_t md_file_path_length = strlen(md_file_path); md_file_path_length -= 3; // html char *new_file_path = Dowa_Arena_Allocate(arena, 1024); @@ -137,11 +136,14 @@ FILE *new_file_fd = fopen(new_file_path, "w+"); if (!new_file_fd) - return; + { + Dowa_Arena_Free(arena); + return 1; + } printf("Saving to %s...\n", new_file_path); fwrite(ssr_body, 1, buffer_sizes, new_file_fd); fclose(new_file_fd); } + Dowa_Arena_Free(arena); return 0; } -