atproto relay implementation in zig zlay.waow.tech
9
fork

Configure Feed

Select the types of activity you want to include in your feed.

fix malloc_trim: move @cImport to top-level for zig 0.15 compat

@cImport inline inside a comptime block doesn't work on zig 0.15.
move the import to module scope with a comptime os check.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>

zzstoatzz 51f46dfc 5ec37cb9

+2 -1
+2 -1
src/main.zig
··· 36 36 const resync_mod = @import("resync.zig"); 37 37 const api = @import("api.zig"); 38 38 const build_options = @import("build_options"); 39 + const malloc_h = if (builtin.os.tag == .linux) @cImport(@cInclude("malloc.h")) else struct {}; 39 40 40 41 const log = std.log.scoped(.relay); 41 42 ··· 316 317 317 318 // return freed pages to OS (glibc-specific, no-op on other platforms) 318 319 if (comptime builtin.os.tag == .linux) { 319 - _ = @cImport(@cInclude("malloc.h")).malloc_trim(0); 320 + _ = malloc_h.malloc_trim(0); 320 321 log.info("gc: malloc_trim complete", .{}); 321 322 } 322 323 }