diff options
author | jbj <devnull@localhost> | 1999-12-15 15:51:30 +0000 |
---|---|---|
committer | jbj <devnull@localhost> | 1999-12-15 15:51:30 +0000 |
commit | 8885331b742acd8a827771fabe51b527c1b455b7 (patch) | |
tree | 38c1c124154d573ee49a2ca4529675ac4bb1a10c /lib/depends.c | |
parent | dab52919d121711f70e286416e2304733aa2e268 (diff) | |
download | librpm-tizen-8885331b742acd8a827771fabe51b527c1b455b7.tar.gz librpm-tizen-8885331b742acd8a827771fabe51b527c1b455b7.tar.bz2 librpm-tizen-8885331b742acd8a827771fabe51b527c1b455b7.zip |
fix: compressFileList was over-generating dirNames.
fix: alAddPackage sorted dirNames too soon, destroying dirMapping.
CVS patchset: 3481
CVS date: 1999/12/15 15:51:30
Diffstat (limited to 'lib/depends.c')
-rw-r--r-- | lib/depends.c | 19 |
1 files changed, 13 insertions, 6 deletions
diff --git a/lib/depends.c b/lib/depends.c index 970a8da87..38722f7a7 100644 --- a/lib/depends.c +++ b/lib/depends.c @@ -128,7 +128,7 @@ static void alFree(struct availableList * al) if (al->numDirs) free(al->dirs); - al->dirs = NULL; + al->dirs = NULL; if (al->alloced && al->list) free(al->list); @@ -139,7 +139,11 @@ static void alFree(struct availableList * al) static int dirInfoCompare(const void * one, const void * two) { const struct dirInfo * a = one; const struct dirInfo * b = two; + int lenchk = a->dirNameLen - b->dirNameLen; + if (lenchk) + return lenchk; + /* XXX FIXME: this might do "backward" strcmp for speed */ return strcmp(a->dirName, b->dirName); } @@ -211,23 +215,21 @@ static /*@exposed@*/ struct availablePackage * alAddPackage(struct availableList for (dirNum = 0; dirNum < numDirs; dirNum++) { dirNeedle.dirName = (char *) dirNames[dirNum]; + dirNeedle.dirNameLen = strlen(dirNames[dirNum]); dirMatch = bsearch(&dirNeedle, al->dirs, origNumDirs, sizeof(dirNeedle), dirInfoCompare); if (dirMatch) { dirMapping[dirNum] = dirMatch - al->dirs; } else { + dirMapping[dirNum] = al->numDirs; al->dirs[al->numDirs].dirName = xstrdup(dirNames[dirNum]); + al->dirs[al->numDirs].dirNameLen = strlen(dirNames[dirNum]); al->dirs[al->numDirs].files = NULL; al->dirs[al->numDirs].numFiles = 0; - al->dirs[al->numDirs].dirNum = al->numDirs; - dirMapping[dirNum] = al->numDirs; al->numDirs++; } } - if (origNumDirs + al->numDirs) - qsort(al->dirs, al->numDirs, sizeof(dirNeedle), dirInfoCompare); - free(dirNames); first = 0; @@ -251,6 +253,10 @@ static /*@exposed@*/ struct availablePackage * alAddPackage(struct availableList first = last + 1; } + + if (origNumDirs + al->numDirs) + qsort(al->dirs, al->numDirs, sizeof(dirNeedle), dirInfoCompare); + } p->key = key; @@ -763,6 +769,7 @@ alFileSatisfiesDepend(struct availableList * al, } dirNeedle.dirName = (char *) dirName; + dirNeedle.dirNameLen = strlen(dirName); dirMatch = bsearch(&dirNeedle, al->dirs, al->numDirs, sizeof(dirNeedle), dirInfoCompare); xfree(dirName); |