| 170 | } |
| 171 | |
| 172 | struct ewah_bitmap *read_bitmap(const unsigned char *map, |
| 173 | size_t map_size, size_t *map_pos) |
| 174 | { |
| 175 | struct ewah_bitmap *b = ewah_pool_new(); |
| 176 | |
| 177 | ssize_t bitmap_size = ewah_read_mmap(b, map + *map_pos, |
| 178 | map_size - *map_pos); |
| 179 | |
| 180 | if (bitmap_size < 0) { |
| 181 | error(_("failed to load bitmap index (corrupted?)")); |
| 182 | ewah_pool_free(b); |
| 183 | return NULL; |
| 184 | } |
| 185 | |
| 186 | *map_pos += bitmap_size; |
| 187 | |
| 188 | return b; |
| 189 | } |
| 190 | |
| 191 | /* |
| 192 | * Read a bitmap from the current read position on the mmaped |
no test coverage detected