summaryrefslogtreecommitdiff
path: root/lib/depends.c
diff options
context:
space:
mode:
authorjbj <devnull@localhost>1999-11-26 21:58:42 +0000
committerjbj <devnull@localhost>1999-11-26 21:58:42 +0000
commitf202d104d070c43fa9b1f029fa85f6b7517ae5c6 (patch)
treee4e6b51ec6c39ac7979e5231f1057ace262cbe28 /lib/depends.c
parentc8406c80d2a9670df64f1ab7e38d90626cad906f (diff)
downloadlibrpm-tizen-f202d104d070c43fa9b1f029fa85f6b7517ae5c6.tar.gz
librpm-tizen-f202d104d070c43fa9b1f029fa85f6b7517ae5c6.tar.bz2
librpm-tizen-f202d104d070c43fa9b1f029fa85f6b7517ae5c6.zip
Consistent usage for fileNames, baseNames, dirNames and dirIndexes throughout.
rpm.c: Add --nodirtokens and --dirtokens to control file list compression. lib/misc.c: Default (conservative) valuse _noDirTokens is TRUE. lib/misc.c: Add expandFileList analogue to compressFileList. build/pack.c: Compress file list only if compression is requested. lib/rpmdb.c: Expand file list before headerWrite if compression not requested. CVS patchset: 3436 CVS date: 1999/11/26 21:58:42
Diffstat (limited to 'lib/depends.c')
-rw-r--r--lib/depends.c67
1 files changed, 35 insertions, 32 deletions
diff --git a/lib/depends.c b/lib/depends.c
index 1c932e117..4670c3921 100644
--- a/lib/depends.c
+++ b/lib/depends.c
@@ -106,8 +106,8 @@ static void alFree( /*@only@*/ struct availableList * al)
free(al->list[i].provides);
if (al->list[i].providesEVR)
free(al->list[i].providesEVR);
- if (al->list[i].baseFileNames)
- free(al->list[i].baseFileNames);
+ if (al->list[i].baseNames)
+ free(al->list[i].baseNames);
headerFree(al->list[i].h);
if (al->list[i].relocs) {
@@ -149,7 +149,7 @@ static /*@exposed@*/ struct availablePackage * alAddPackage(struct availableList
rpmRelocation * r;
int i;
int_32 * fileDirIndex;
- char ** dirList;
+ const char ** dirNames;
int numDirs, dirNum;
int * dirMapping;
struct dirInfo dirNeedle;
@@ -186,12 +186,12 @@ static /*@exposed@*/ struct availablePackage * alAddPackage(struct availableList
}
if (!headerGetEntryMinMemory(h, RPMTAG_COMPFILELIST, NULL, (void **)
- &p->baseFileNames, &p->filesCount)) {
+ &p->baseNames, &p->filesCount)) {
p->filesCount = 0;
- p->baseFileNames = NULL;
+ p->baseNames = NULL;
} else {
headerGetEntryMinMemory(h, RPMTAG_COMPDIRLIST, NULL, (void **)
- &dirList, &numDirs);
+ &dirNames, &numDirs);
headerGetEntryMinMemory(h, RPMTAG_COMPFILEDIRS, NULL, (void **)
&fileDirIndex, NULL);
@@ -206,13 +206,13 @@ static /*@exposed@*/ struct availablePackage * alAddPackage(struct availableList
origNumDirs = al->numDirs;
for (dirNum = 0; dirNum < numDirs; dirNum++) {
- dirNeedle.dirName = dirList[dirNum];
+ dirNeedle.dirName = (char *) dirNames[dirNum];
dirMatch = bsearch(&dirNeedle, al->dirs, origNumDirs,
sizeof(dirNeedle), dirInfoCompare);
if (dirMatch) {
dirMapping[dirNum] = dirMatch - al->dirs;
} else {
- al->dirs[al->numDirs].dirName = xstrdup(dirList[dirNum]);
+ al->dirs[al->numDirs].dirName = xstrdup(dirNames[dirNum]);
al->dirs[al->numDirs].files = NULL;
al->dirs[al->numDirs].numFiles = 0;
al->dirs[al->numDirs].dirNum = al->numDirs;
@@ -224,7 +224,7 @@ static /*@exposed@*/ struct availablePackage * alAddPackage(struct availableList
if (origNumDirs + al->numDirs)
qsort(al->dirs, al->numDirs, sizeof(dirNeedle), dirInfoCompare);
- free(dirList);
+ free(dirNames);
first = 0;
while (first < p->filesCount) {
@@ -239,8 +239,8 @@ static /*@exposed@*/ struct availablePackage * alAddPackage(struct availableList
sizeof(*dirMatch->files) *
(dirMatch->numFiles + last - first + 1));
for (fileNum = first; fileNum <= last; fileNum++) {
- dirMatch->files[dirMatch->numFiles].basename =
- p->baseFileNames[fileNum];
+ dirMatch->files[dirMatch->numFiles].baseName =
+ p->baseNames[fileNum];
dirMatch->files[dirMatch->numFiles].package = p;
dirMatch->numFiles++;
}
@@ -715,8 +715,8 @@ void rpmtransFree(rpmTransactionSet rpmdep)
free(rpmdep);
}
-void rpmdepFreeConflicts(struct rpmDependencyConflict * conflicts, int
- numConflicts)
+void rpmdepFreeConflicts(struct rpmDependencyConflict * conflicts,
+ int numConflicts)
{
int i;
@@ -734,29 +734,32 @@ void rpmdepFreeConflicts(struct rpmDependencyConflict * conflicts, int
/*@dependent@*/ /*@null@*/ static struct availablePackage *
alFileSatisfiesDepend(struct availableList * al, const char * keyType,
- const char *fileName)
+ const char * fileName)
{
int i;
- char * file = xstrdup(fileName);
- char * chptr = strrchr(file, '/');
- char * base;
+ const char * dirName;
+ const char * baseName;
struct dirInfo dirNeedle;
struct dirInfo * dirMatch;
- chptr++;
- *chptr = '\0';
+ { char * chptr = xstrdup(fileName);
+ dirName = chptr;
+ chptr = strrchr(chptr, '/');
+ chptr++;
+ *chptr = '\0';
+ }
- dirNeedle.dirName = file;
+ dirNeedle.dirName = (char *) dirName;
dirMatch = bsearch(&dirNeedle, al->dirs, al->numDirs,
sizeof(dirNeedle), dirInfoCompare);
- free(file);
+ xfree(dirName);
if (!dirMatch) return NULL;
- base = strrchr(fileName, '/') + 1;
+ baseName = strrchr(fileName, '/') + 1;
/* XXX FIXME: these file lists should be sorted and bsearched */
for (i = 0; i < dirMatch->numFiles; i++) {
- if (!strcmp(dirMatch->files[i].basename, base)) {
+ if (!strcmp(dirMatch->files[i].baseName, baseName)) {
if (keyType)
rpmMessage(RPMMESS_DEBUG, _("%s: %s satisfied by added file "
"list.\n"), keyType, fileName);
@@ -1355,7 +1358,7 @@ int rpmdepCheck(rpmTransactionSet rpmdep,
{
struct availablePackage * p;
int i, j;
- const char ** baseFileNames, ** dirList;
+ const char ** baseNames, ** dirNames;
int_32 * dirIndexes;
int fileCount;
int rc;
@@ -1439,21 +1442,21 @@ int rpmdepCheck(rpmTransactionSet rpmdep,
}
if (headerGetEntry(h, RPMTAG_COMPFILELIST, NULL,
- (void **) &baseFileNames, &fileCount)) {
+ (void **) &baseNames, &fileCount)) {
headerGetEntry(h, RPMTAG_COMPDIRLIST, NULL,
- (void **) &dirList, NULL);
+ (void **) &dirNames, NULL);
headerGetEntry(h, RPMTAG_COMPFILEDIRS, NULL,
(void **) &dirIndexes, NULL);
rc = 0;
for (j = 0; j < fileCount; j++) {
- len = strlen(baseFileNames[j]) + 1 +
- strlen(dirList[dirIndexes[j]]);
+ len = strlen(baseNames[j]) + 1 +
+ strlen(dirNames[dirIndexes[j]]);
if (len > fileAlloced) {
fileAlloced = len * 2;
filespec = xrealloc(filespec, fileAlloced);
}
- strcpy(filespec, dirList[dirIndexes[j]]);
- strcat(filespec, baseFileNames[j]);
+ strcpy(filespec, dirNames[dirIndexes[j]]);
+ strcat(filespec, baseNames[j]);
/* Erasing: check filename against requiredby matches. */
if (checkDependentPackages(rpmdep, &ps, filespec)) {
rc = 1;
@@ -1461,8 +1464,8 @@ int rpmdepCheck(rpmTransactionSet rpmdep,
}
}
- free(baseFileNames);
- free(dirList);
+ free(baseNames);
+ free(dirNames);
if (rc) goto exit;
}