| 334 | } |
| 335 | |
| 336 | static struct stored_bitmap *store_bitmap(struct bitmap_index *index, |
| 337 | struct ewah_bitmap *root, |
| 338 | const struct object_id *oid, |
| 339 | struct stored_bitmap *xor_with, |
| 340 | int flags, size_t map_pos) |
| 341 | { |
| 342 | struct stored_bitmap *stored; |
| 343 | khiter_t hash_pos; |
| 344 | int ret; |
| 345 | |
| 346 | stored = xmalloc(sizeof(struct stored_bitmap)); |
| 347 | stored->map_pos = map_pos; |
| 348 | stored->root = root; |
| 349 | stored->xor = xor_with; |
| 350 | stored->flags = flags; |
| 351 | oidcpy(&stored->oid, oid); |
| 352 | |
| 353 | hash_pos = kh_put_oid_map(index->bitmaps, stored->oid, &ret); |
| 354 | |
| 355 | /* |
| 356 | * A 0 return code means the insertion succeeded with no changes, |
| 357 | * because the SHA1 already existed on the map. This is bad, there |
| 358 | * shouldn't be duplicated commits in the index. |
| 359 | */ |
| 360 | if (ret == 0) { |
| 361 | error(_("duplicate entry in bitmap index: '%s'"), oid_to_hex(oid)); |
| 362 | return NULL; |
| 363 | } |
| 364 | |
| 365 | kh_value(index->bitmaps, hash_pos) = stored; |
| 366 | return stored; |
| 367 | } |
| 368 | |
| 369 | static inline uint32_t read_be32(const unsigned char *buffer, size_t *pos) |
| 370 | { |
no test coverage detected