beansprout-custom/src
Ben Buhse b48032bbba
Change two uses of alloc to use stack buffers
I was looking for places where it might have made sense to use something
like an arena or a fba instead of the C allocator, but almost all of the
allocations are for Wayland interfaces that are fairly long lived (and,
since they're using libwayland, need the C allocator).

Instead, I just found two places that could use buffers on the stack
instead. In Config.zig, we *were* allocating the config path with
fmt.AllocPrint, but std.fs.max_path_bytes exists, so we can just make
a buf of that size and save a heap allocation. This is only at start up
and on config reload so it doesn't do too much, but I'd like to remove
allocations when possible.

The other change is for utils.parseModifiers(). It was using
std.ascii.allocLowerString(), but we clamp the length of the string to
3-5 characters, so we can just make a 5 character buffer and then use
ascii.lowerString() instead. Again, not super helpful since the function
is (currently) only called when creating Configs, but it's still nice to
get rid of a heap alloc.
2026-02-12 14:10:28 -06:00
..
Buffer.zig Add REUSE licensing for non-code files 2026-02-11 14:50:04 -06:00
BufferPool.zig Rename utils.allocator to utils.gpa 2026-02-12 14:10:28 -06:00
Config.zig Change two uses of alloc to use stack buffers 2026-02-12 14:10:28 -06:00
Context.zig Rename utils.allocator to utils.gpa 2026-02-12 14:10:28 -06:00
flags.zig Implement some simple flags and runtime log-levels 2026-02-08 16:25:30 -06:00
InputDevice.zig Rename utils.allocator to utils.gpa 2026-02-12 14:10:28 -06:00
InputManager.zig Rename utils.allocator to utils.gpa 2026-02-12 14:10:28 -06:00
LibinputDevice.zig Rename utils.allocator to utils.gpa 2026-02-12 14:10:28 -06:00
main.zig Rename utils.allocator to utils.gpa 2026-02-12 14:10:28 -06:00
Output.zig Rename utils.allocator to utils.gpa 2026-02-12 14:10:28 -06:00
Seat.zig Rename utils.allocator to utils.gpa 2026-02-12 14:10:28 -06:00
utils.zig Change two uses of alloc to use stack buffers 2026-02-12 14:10:28 -06:00
WallpaperImage.zig Rename utils.allocator to utils.gpa 2026-02-12 14:10:28 -06:00
Window.zig Rename utils.allocator to utils.gpa 2026-02-12 14:10:28 -06:00
WindowManager.zig Rename utils.allocator to utils.gpa 2026-02-12 14:10:28 -06:00
XkbBindings.zig Rename utils.allocator to utils.gpa 2026-02-12 14:10:28 -06:00