Skip to content

Commit 3203d47

Browse files
committed
Update README
1 parent aa5e70f commit 3203d47

1 file changed

Lines changed: 5 additions & 2 deletions

File tree

README.md

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff 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;
6062
typedef 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;
6771
typedef 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

0 commit comments

Comments
 (0)