From 50e493aad5e48fc1d00615afdc8f96e58905cd02 Mon Sep 17 00:00:00 2001 From: Emil Lerch Date: Fri, 9 Jan 2026 11:59:35 -0800 Subject: [PATCH] stack allocate the cache key for weather --- src/weather/Provider.zig | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/weather/Provider.zig b/src/weather/Provider.zig index d9a3852..490428e 100644 --- a/src/weather/Provider.zig +++ b/src/weather/Provider.zig @@ -23,8 +23,8 @@ pub const VTable = struct { pub fn fetch(self: WeatherProvider, allocator: std.mem.Allocator, coords: Coordinates) !types.WeatherData { // Generate cache key from coordinates - const cache_key = try std.fmt.allocPrint(allocator, "{d:.4},{d:.4}", .{ coords.latitude, coords.longitude }); - defer allocator.free(cache_key); + var buf: [256]u8 = undefined; + const cache_key = try std.fmt.bufPrint(&buf, "{d:.4},{d:.4}", .{ coords.latitude, coords.longitude }); // Check cache first if (self.cache.get(cache_key)) |cached_raw|