aboutsummaryrefslogtreecommitdiff
path: root/lib/std/http/headers.zig
diff options
context:
space:
mode:
authorSahnvour <Sahnvour@users.noreply.github.com>2020-09-02 08:52:32 +0200
committerGitHub <noreply@github.com>2020-09-02 08:52:32 +0200
commit90ace40e07de7bca2558da72e6d67cf660f86192 (patch)
treeb3cc13576ad7d9fc94a80776aa4008316c0ff746 /lib/std/http/headers.zig
parent1b2154dfe2f9b5030f487e7c4be8c706ce6e59b5 (diff)
parent575fbd5e3592cff70cbfc5153884d919e6bed89f (diff)
downloadzig-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.zig9
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