| 356 | } |
| 357 | |
| 358 | static int unuse_one_window(struct object_database *odb) |
| 359 | { |
| 360 | struct odb_source *source; |
| 361 | struct packfile_list_entry *e; |
| 362 | struct packed_git *lru_p = NULL; |
| 363 | struct pack_window *lru_w = NULL, *lru_l = NULL; |
| 364 | |
| 365 | for (source = odb->sources; source; source = source->next) { |
| 366 | struct odb_source_files *files = odb_source_files_downcast(source); |
| 367 | for (e = files->packed->packs.head; e; e = e->next) |
| 368 | scan_windows(e->pack, &lru_p, &lru_w, &lru_l); |
| 369 | } |
| 370 | |
| 371 | if (lru_p) { |
| 372 | munmap(lru_w->base, lru_w->len); |
| 373 | pack_mapped -= lru_w->len; |
| 374 | if (lru_l) |
| 375 | lru_l->next = lru_w->next; |
| 376 | else |
| 377 | lru_p->windows = lru_w->next; |
| 378 | free(lru_w); |
| 379 | pack_open_windows--; |
| 380 | return 1; |
| 381 | } |
| 382 | return 0; |
| 383 | } |
| 384 | |
| 385 | void close_pack_windows(struct packed_git *p) |
| 386 | { |
no test coverage detected