diff options
| author | Sahnvour <Sahnvour@users.noreply.github.com> | 2020-09-02 08:52:32 +0200 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2020-09-02 08:52:32 +0200 |
| commit | 90ace40e07de7bca2558da72e6d67cf660f86192 (patch) | |
| tree | b3cc13576ad7d9fc94a80776aa4008316c0ff746 /lib/std/http/headers.zig | |
| parent | 1b2154dfe2f9b5030f487e7c4be8c706ce6e59b5 (diff) | |
| parent | 575fbd5e3592cff70cbfc5153884d919e6bed89f (diff) | |
| download | zig-90ace40e07de7bca2558da72e6d67cf660f86192.tar.gz zig-90ace40e07de7bca2558da72e6d67cf660f86192.zip | |
Merge pull request #5999 from Sahnvour/hashmap
New hashmap implementation
Diffstat (limited to 'lib/std/http/headers.zig')
| -rw-r--r-- | lib/std/http/headers.zig | 9 |
1 files changed, 5 insertions, 4 deletions
diff --git a/lib/std/http/headers.zig b/lib/std/http/headers.zig index 8c80af512f..0ce642865c 100644 --- a/lib/std/http/headers.zig +++ b/lib/std/http/headers.zig @@ -123,9 +123,9 @@ pub const Headers = struct { pub fn deinit(self: *Self) void { { - for (self.index.items()) |*entry| { - const dex = &entry.value; - dex.deinit(self.allocator); + var it = self.index.iterator(); + while (it.next()) |entry| { + entry.value.deinit(self.allocator); self.allocator.free(entry.key); } self.index.deinit(self.allocator); @@ -333,7 +333,8 @@ pub const Headers = struct { fn rebuildIndex(self: *Self) void { // clear out the indexes - for (self.index.items()) |*entry| { + var it = self.index.iterator(); + while (it.next()) |entry| { entry.value.shrinkRetainingCapacity(0); } // fill up indexes again; we know capacity is fine from before |
