Skip to content

Commit 85d3399

Browse files
committed
Replace fmtSliceHexLower with {x} format string
1 parent 6f12f0d commit 85d3399

File tree

3 files changed

+8
-8
lines changed

3 files changed

+8
-8
lines changed

src/compile/cache_config.zig

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -198,7 +198,7 @@ pub fn getCompilerVersionDir(allocator: Allocator) ![]u8 {
198198

199199
// Use first 16 bytes (32 hex chars) for directory name
200200
const hex_chars = try allocator.alloc(u8, 32);
201-
_ = std.fmt.bufPrint(hex_chars, "{}", .{std.fmt.fmtSliceHexLower(hash[0..16])}) catch unreachable;
201+
_ = std.fmt.bufPrint(hex_chars, "{x}", .{hash[0..16]}) catch unreachable;
202202

203203
return hex_chars;
204204
}

src/compile/cache_key.zig

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -69,7 +69,7 @@ pub const CacheKey = struct {
6969

7070
// Convert to hex string
7171
const filename = try allocator.alloc(u8, combined_hash.len * 2);
72-
_ = std.fmt.bufPrint(filename, "{}", .{std.fmt.fmtSliceHexLower(&combined_hash)}) catch unreachable;
72+
_ = std.fmt.bufPrint(filename, "{x}", .{&combined_hash}) catch unreachable;
7373

7474
return filename;
7575
}
@@ -91,10 +91,10 @@ pub const CacheKey = struct {
9191
_ = fmt;
9292
_ = options;
9393

94-
try writer.print("CacheKey{{ content: {}, mtime: {}, compiler: {} }}", .{
95-
std.fmt.fmtSliceHexLower(self.content_hash[0..8]), // First 8 bytes for readability
94+
try writer.print("CacheKey{{ content: {x}, mtime: {}, compiler: {x} }}", .{
95+
self.content_hash[0..8], // First 8 bytes for readability
9696
self.file_mtime,
97-
std.fmt.fmtSliceHexLower(self.compiler_version[0..8]), // First 8 bytes for readability
97+
self.compiler_version[0..8], // First 8 bytes for readability
9898
});
9999
}
100100

src/compile/cache_manager.zig

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -208,11 +208,11 @@ pub const CacheManager = struct {
208208

209209
// Split key: first 2 chars for subdirectory, rest for filename
210210
var subdir_buf: [2]u8 = undefined;
211-
_ = std.fmt.bufPrint(&subdir_buf, "{}", .{std.fmt.fmtSliceHexLower(cache_key[0..1])}) catch unreachable;
211+
_ = std.fmt.bufPrint(&subdir_buf, "{x}", .{cache_key[0..1]}) catch unreachable;
212212
const subdir = subdir_buf[0..];
213213

214214
var filename_buf: [62]u8 = undefined;
215-
_ = std.fmt.bufPrint(&filename_buf, "{}", .{std.fmt.fmtSliceHexLower(cache_key[1..32])}) catch unreachable;
215+
_ = std.fmt.bufPrint(&filename_buf, "{x}", .{cache_key[1..32]}) catch unreachable;
216216
const filename = filename_buf[0..];
217217

218218
const cache_subdir = try std.fs.path.join(self.allocator, &[_][]const u8{ entries_dir, subdir });
@@ -228,7 +228,7 @@ pub const CacheManager = struct {
228228

229229
// Print the hex of the first byte into a fixed-size buffer for the subdir
230230
var subdir_buf: [2]u8 = undefined;
231-
_ = std.fmt.bufPrint(&subdir_buf, "{}", .{std.fmt.fmtSliceHexLower(cache_key[0..1])}) catch unreachable;
231+
_ = std.fmt.bufPrint(&subdir_buf, "{x}", .{cache_key[0..1]}) catch unreachable;
232232
const subdir = subdir_buf[0..];
233233
const full_subdir = try std.fs.path.join(self.allocator, &[_][]const u8{ entries_dir, subdir });
234234
defer self.allocator.free(full_subdir);

0 commit comments

Comments
 (0)