Commit 7fc97eb
committed
index: fix resizing index map twice on case-insensitive systems
Depending on whether the index map is case-sensitive or insensitive, we
need to call either `git_idxmap_icase_resize` or `git_idxmap_resize`.
There are multiple locations where we thus use the following pattern:
if (index->ignore_case &&
git_idxmap_icase_resize(map, length) < 0)
return -1;
else if (git_idxmap_resize(map, length) < 0)
return -1;
The funny thing is: on case-insensitive systems, we will try to resize
the map twice in case where `git_idxmap_icase_resize()` doesn't error.
While this will still use the correct hashing function as both map types
use the same, this bug will at least cause us to resize the map twice in
a row.
Fix the issue by introducing a new function `index_map_resize` that
handles case-sensitivity, similar to how `index_map_set` and
`index_map_delete`. Convert all call sites where we were previously
resizing the map to use that new function.1 parent ab45887 commit 7fc97eb
1 file changed
+14
-17
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
141 | 141 | | |
142 | 142 | | |
143 | 143 | | |
| 144 | + | |
| 145 | + | |
| 146 | + | |
| 147 | + | |
| 148 | + | |
| 149 | + | |
| 150 | + | |
| 151 | + | |
144 | 152 | | |
145 | 153 | | |
146 | 154 | | |
| |||
1620 | 1628 | | |
1621 | 1629 | | |
1622 | 1630 | | |
1623 | | - | |
| 1631 | + | |
| 1632 | + | |
1624 | 1633 | | |
1625 | 1634 | | |
1626 | 1635 | | |
| |||
2608 | 2617 | | |
2609 | 2618 | | |
2610 | 2619 | | |
2611 | | - | |
2612 | | - | |
2613 | | - | |
2614 | | - | |
2615 | | - | |
| 2620 | + | |
2616 | 2621 | | |
2617 | 2622 | | |
2618 | 2623 | | |
| |||
3125 | 3130 | | |
3126 | 3131 | | |
3127 | 3132 | | |
3128 | | - | |
3129 | | - | |
3130 | | - | |
3131 | | - | |
3132 | | - | |
| 3133 | + | |
3133 | 3134 | | |
3134 | 3135 | | |
3135 | 3136 | | |
| |||
3185 | 3186 | | |
3186 | 3187 | | |
3187 | 3188 | | |
3188 | | - | |
3189 | | - | |
3190 | | - | |
3191 | | - | |
3192 | | - | |
3193 | | - | |
| 3189 | + | |
| 3190 | + | |
3194 | 3191 | | |
3195 | 3192 | | |
3196 | 3193 | | |
| |||
0 commit comments