more robust bdz for numbers + helpers

This commit is contained in:
2022-03-02 11:05:20 +02:00
committed by Motiejus Jakštys
parent 4fc54e5b65
commit e1bdb6c529
5 changed files with 176 additions and 61 deletions

View File

@@ -119,10 +119,7 @@ pub const ShellWriter = struct {
if (res.found_existing) {
res.value_ptr.* += 1;
} else {
// TODO(motiejus): can we avoid `ourShell` variable here?
const ourShell = try self.allocator.alloc(u8, shell.len);
std.mem.copy(u8, ourShell, shell);
res.key_ptr.* = ourShell;
res.key_ptr.* = try self.allocator.dupe(u8, shell);
res.value_ptr.* = 1;
}
}