From: Michael Schroeder Date: Tue, 20 Dec 2011 18:31:13 +0000 (+0100) Subject: update markerpos if element needed to be moved X-Git-Tag: BASE-SuSE-Code-12_2-Branch~228 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=a533b7e786f29cb0123712163cc8dea4f80b032e;p=thirdparty%2Flibsolv.git update markerpos if element needed to be moved --- diff --git a/src/repo.c b/src/repo.c index c012572c..4a4a69f7 100644 --- a/src/repo.c +++ b/src/repo.c @@ -358,6 +358,8 @@ repo_addid_dep_hash(Repo *repo, Offset olddeps, Id id, Id marker, int size) /* put new element in hash */ if (!hid) repo->lastidhash[h] = id; + else if (marker == SOLVABLE_FILEMARKER) + return olddeps; if (marker && !before && !repo->lastmarkerpos) { /* we have to add the marker first */ @@ -373,6 +375,7 @@ repo_addid_dep_hash(Repo *repo, Offset olddeps, Id id, Id marker, int size) } if (!hid) { + /* new entry, insert in correct position */ if (marker && before && repo->lastmarkerpos) { /* need to add it before the marker */ @@ -389,7 +392,7 @@ repo_addid_dep_hash(Repo *repo, Offset olddeps, Id id, Id marker, int size) return olddeps; } /* we already have it in the hash */ - if (!marker || before || marker == SOLVABLE_FILEMARKER) + if (!marker || before) return olddeps; /* check if it is in the correct half */ for (oidp = repo->idarraydata + repo->lastmarkerpos + 1; (oid = *oidp) != 0; oidp++) @@ -403,6 +406,7 @@ repo_addid_dep_hash(Repo *repo, Offset olddeps, Id id, Id marker, int size) return olddeps; /* should not happen */ memmove(oidp, oidp + 1, (repo->idarraydata + repo->idarraysize - oidp - 2) * sizeof(Id)); repo->idarraydata[repo->idarraysize - 2] = id; + repo->lastmarkerpos--; /* marker has been moved */ return olddeps; }