From a533b7e786f29cb0123712163cc8dea4f80b032e Mon Sep 17 00:00:00 2001 From: Michael Schroeder Date: Tue, 20 Dec 2011 19:31:13 +0100 Subject: [PATCH] update markerpos if element needed to be moved --- src/repo.c | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) 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; } -- 2.47.3