- // dependency data is already fine, we just set the reverse link
- // and in such a way that the loop above can finish fast, so we keep
- // non-duplicates at the front and for the duplicates we:
- // a) move to the end of the list, b) insert before another own duplicate
- // or c) find two duplicates behind each other.
- map_pointer_t const own_id = Link->DependencyData;
- while (*PkgRevDepends != 0)
- {
- pkgCache::Dependency * const L = Cache.DepP + *PkgRevDepends;
- PkgRevDepends = &L->NextRevDepends;
- if (L->DependencyData == own_id || L->DependencyData == previous_id)
- {
- Link->NextRevDepends = L->NextRevDepends;
- break;
- }
- previous_id = L->DependencyData;
- }
- *PkgRevDepends = Dependency;