File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -57,13 +57,17 @@ typedef struct {
5757 int value;
5858} WordFreq;
5959
60+ // Could also create this typedef with `HashMap` utility macro:
61+ // typedef HashMap(StringSlice, int) WordMap;
6062typedef struct {
6163 WordFreq* entries;
6264 size_t* hashes;
6365 size_t size, capacity;
6466 Allocator* allocator;
6567} WordMap;
6668
69+ // Could also create this typedef with `Array` utility macro:
70+ // typedef Array(StringSlice) Words;
6771typedef struct {
6872 StringSlice* items;
6973 size_t size, capacity;
@@ -97,8 +101,7 @@ int main(int argc, char** argv) {
97101
98102 WordMap word_freqs = {0};
99103 array_foreach(StringSlice, it, &words) {
100- WordFreq* e;
101- hmap_get_default_ss(&word_freqs, *it, 0, &e);
104+ WordFreq* e = hmap_get_default_ss(&word_freqs, *it, 0);
102105 e->value++;
103106 }
104107
You can’t perform that action at this time.
0 commit comments