Commit aa5e70f
authored
Merge pull request #1 from bamless/hashmap-rework
- Breaking changes on hashmap implementation:
Reworked the hashmap implementation to make possible the usage of `ext_hmap_get` and
`ext_hmap_get_default` family of functions as expressions. Now it is possible to do
things like:
```c
Entry* e = hmap_get_cstr(&hmap, "key");
if(e != NULL) {
...
}
```
- Added `Ext_Array` and `Ext_HashMap`/`Ext_Entry` macros to define required struct layout
for both dynamic arrays and hashmap in-line.
This makes it possible to skip declaring the full struct by hand when we do not need
to reference it by name (i.e. create variables to it, pass it to functions, etc.):
```c
Array(int) int_array = {0};
HashMap(char*, int) int_map = {0};
```
Declaring full struct layout by hand is still supported.
- Breaking change: removed deprecated functions and macros:
1. `ext_strdup_alloc` and `ext_memdup_alloc`
2. `EXT_DEFER_LOOP`4 files changed
Lines changed: 570 additions & 243 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
11 | 11 | | |
12 | 12 | | |
13 | 13 | | |
| 14 | + | |
| 15 | + | |
14 | 16 | | |
15 | 17 | | |
16 | 18 | | |
| |||
22 | 24 | | |
23 | 25 | | |
24 | 26 | | |
| 27 | + | |
| 28 | + | |
25 | 29 | | |
26 | 30 | | |
27 | 31 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
121 | 121 | | |
122 | 122 | | |
123 | 123 | | |
124 | | - | |
125 | | - | |
| 124 | + | |
126 | 125 | | |
127 | 126 | | |
128 | 127 | | |
| |||
0 commit comments