The map produced by make_map() owns all heap memory the same way the * loader does, so the public free routine on the wrapping collection * works equivalently — but tests build naked maps, so use this helper. */
| 72 | * loader does, so the public free routine on the wrapping collection |
| 73 | * works equivalently — but tests build naked maps, so use this helper. */ |
| 74 | static void free_map(cbm_path_alias_map_t *map) { |
| 75 | if (!map) { |
| 76 | return; |
| 77 | } |
| 78 | for (int i = 0; i < map->count; i++) { |
| 79 | free(map->entries[i].alias_prefix); |
| 80 | free(map->entries[i].alias_suffix); |
| 81 | free(map->entries[i].target_prefix); |
| 82 | free(map->entries[i].target_suffix); |
| 83 | } |
| 84 | free(map->entries); |
| 85 | free(map->base_url); |
| 86 | free(map); |
| 87 | } |
| 88 | |
| 89 | /* ── Basic wildcard alias ──────────────────────────────────────── */ |
| 90 |