diff options
author | DongHun Kwak <dh0128.kwak@samsung.com> | 2016-10-27 14:54:07 +0900 |
---|---|---|
committer | DongHun Kwak <dh0128.kwak@samsung.com> | 2016-10-27 14:54:07 +0900 |
commit | 8a7ffe4fc2b44b84fb045f80c1a016b3f200aa8b (patch) | |
tree | b51f0d1b486157492f0fb273705ab9c486097833 /src | |
parent | 40d5592805eaa650df84c50b9fed3cbdc4823fc5 (diff) | |
download | libsolv-8a7ffe4fc2b44b84fb045f80c1a016b3f200aa8b.tar.gz libsolv-8a7ffe4fc2b44b84fb045f80c1a016b3f200aa8b.tar.bz2 libsolv-8a7ffe4fc2b44b84fb045f80c1a016b3f200aa8b.zip |
Imported Upstream version 0.6.10upstream/0.6.10
Change-Id: Ia0aa60fc8934d4022da0cf8669ae3e4e121f3386
Signed-off-by: DongHun Kwak <dh0128.kwak@samsung.com>
Diffstat (limited to 'src')
-rw-r--r-- | src/policy.c | 25 |
1 files changed, 8 insertions, 17 deletions
diff --git a/src/policy.c b/src/policy.c index a0ecec1..93d7440 100644 --- a/src/policy.c +++ b/src/policy.c @@ -1048,16 +1048,15 @@ sort_by_common_dep(Pool *pool, Queue *plist) static void dislike_old_versions(Pool *pool, Queue *plist) { - int i, count = plist->count; - Id *elements = plist->elements; - int bad = 0; + int i, count; - for (i = 0; i < count; i++) + for (i = 0, count = plist->count; i < count; i++) { - Id p = elements[i]; + Id p = plist->elements[i]; Solvable *s = pool->solvables + p; Repo *repo = s->repo; Id q, qq; + int bad = 0; if (!repo || repo == pool->installed) continue; @@ -1072,30 +1071,22 @@ dislike_old_versions(Pool *pool, Queue *plist) { if (repo->priority > qs->repo->priority) continue; - elements[i] = -p; bad = 1; break; } if (pool_evrcmp(pool, qs->evr, s->evr, EVRCMP_COMPARE) > 0) { - elements[i] = -p; bad = 1; break; } } - } - if (!bad) - return; - /* now move negative elements to the back */ - for (i = 0; i < count; i++) - { - Id p = elements[i]; - if (p >= 0) + if (!bad) continue; + /* bring to back */ if (i < plist->count - 1) { - memmove(elements + i, elements + i + 1, (plist->count - 1 - i) * sizeof(Id)); - elements[plist->count - 1] = -p; + memmove(plist->elements + i, plist->elements + i + 1, (plist->count - 1 - i) * sizeof(Id)); + plist->elements[plist->count - 1] = p; } i--; count--; |