OLD | NEW |
1 // Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file |
2 // for details. All rights reserved. Use of this source code is governed by a | 2 // for details. All rights reserved. Use of this source code is governed by a |
3 // BSD-style license that can be found in the LICENSE file. | 3 // BSD-style license that can be found in the LICENSE file. |
4 | 4 |
5 #include "platform/hashmap.h" | 5 #include "platform/hashmap.h" |
6 | 6 |
7 #include "bin/builtin.h" | |
8 #include "platform/utils.h" | 7 #include "platform/utils.h" |
9 | 8 |
10 HashMap::HashMap(MatchFun match, | 9 HashMap::HashMap(MatchFun match, |
11 uint32_t initial_capacity) { | 10 uint32_t initial_capacity) { |
12 match_ = match; | 11 match_ = match; |
13 Initialize(initial_capacity); | 12 Initialize(initial_capacity); |
14 } | 13 } |
15 | 14 |
16 | 15 |
17 HashMap::~HashMap() { | 16 HashMap::~HashMap() { |
(...skipping 163 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
181 for (Entry* p = map; n > 0; p++) { | 180 for (Entry* p = map; n > 0; p++) { |
182 if (p->key != NULL) { | 181 if (p->key != NULL) { |
183 Lookup(p->key, p->hash, true)->value = p->value; | 182 Lookup(p->key, p->hash, true)->value = p->value; |
184 n--; | 183 n--; |
185 } | 184 } |
186 } | 185 } |
187 | 186 |
188 // Delete old map. | 187 // Delete old map. |
189 free(map); | 188 free(map); |
190 } | 189 } |
OLD | NEW |