Author: matz Date: Thu Dec 6 05:40:07 2007 New Revision: 8043 URL: http://svn.opensuse.org/viewcvs/zypp?rev=8043&view=rev Log: While trying to regenerate the testsuite I noticed that non-unique depsets happen, so handle them. Modified: trunk/sat-solver/src/repo_solv.c trunk/sat-solver/tools/repo_write.c Modified: trunk/sat-solver/src/repo_solv.c URL: http://svn.opensuse.org/viewcvs/zypp/trunk/sat-solver/src/repo_solv.c?rev=8043&r1=8042&r2=8043&view=diff ============================================================================== --- trunk/sat-solver/src/repo_solv.c (original) +++ trunk/sat-solver/src/repo_solv.c Thu Dec 6 05:40:07 2007 @@ -132,7 +132,7 @@ if ((c & 128) == 0) { x = (x << 6) | (c & 63); - if (!relative || x != 1) + if (!relative || x != 0) { if (relative) { @@ -149,9 +149,9 @@ x = map[x]; } else - /* (relative && x==1) : + /* (relative && x==0) : Ugly PREREQ handling. See repo_write.c. */ - x = SOLVABLE_PREREQMARKER, old = 1; + x = SOLVABLE_PREREQMARKER, old = 0; if (store == end) { pool_debug(mypool, SAT_FATAL, "read_idarray: array overflow\n"); Modified: trunk/sat-solver/tools/repo_write.c URL: http://svn.opensuse.org/viewcvs/zypp/trunk/sat-solver/tools/repo_write.c?rev=8043&r1=8042&r2=8043&view=diff ============================================================================== --- trunk/sat-solver/tools/repo_write.c (original) +++ trunk/sat-solver/tools/repo_write.c Thu Dec 6 05:40:07 2007 @@ -198,6 +198,8 @@ return; if (!*ids) { + /* XXX I think this is broken. A lone '0' will be interpreted as + zero plus end-of-array, which stores another zero. */ write_u8(fp, 0); return; } @@ -233,6 +235,8 @@ return; if (!*ids) { + /* XXX I think this is broken. A lone '0' will be interpreted as + zero plus end-of-array, which stores another zero. */ write_u8 (fp, 0); return; } @@ -258,19 +262,19 @@ Id old = 0; for (i = 0; i < len; i++) - /* Ugly PREREQ handling. A "difference" of 1 is the prereq marker, + /* Ugly PREREQ handling. A "difference" of 0 is the prereq marker, hence all real differences are offsetted by 1. Otherwise we would have to handle negative differences, which would cost code space for the encoding of the sign. We loose the exact mapping of prereq here, but we know the result, so we can recover from that in the reader. */ if (ids[i] == prereq) - old = ids[i] = 1; + old = ids[i] = 0; else { ids[i] -= old; old = ids[i] + old; - /* difference is zero --> we have multiple equal elements in the list */ - assert (ids[i] > 0); + /* XXX If difference is zero we have multiple equal elements, + we might want to skip writing them out. */ ids[i]++; } @@ -280,18 +284,17 @@ space. Even if they are coded only as bits in IDs. The best improvement was about 2.7% for the whole .solv file. It's probably better to invest some complexity into sharing idarrays, than RLEing. */ - for (;;) + for (i = 0; i < len - 1; i++) { - Id id = *ids++; + Id id = ids[i]; if (id >= 64) id = (id & 63) | ((id & ~63) << 1); - if (!*ids) - { - write_id(fp, id); - return; - } write_id(fp, id | 64); } + old = ids[i]; + if (old >= 64) + old = (old & 63) | ((old & ~63) << 1); + write_id(fp, old); } /* -- To unsubscribe, e-mail: zypp-commit+unsubscribe@opensuse.org For additional commands, e-mail: zypp-commit+help@opensuse.org