Code reformatting

This commit is contained in:
Silvan Calarco 2021-02-14 22:26:37 +01:00
parent 9a546f52b9
commit 4f566ceec3

View File

@ -1183,20 +1183,12 @@ generateSourceHeaderList(struct configTag *ct, int mode, int incremental)
/*
* Reads all headers and generates a structure based on struct headerList */
int
addToHeaderList(struct configTag *ct,
int addToHeaderList(struct configTag *ct,
const char *scanpath, /*int mode,*/
const char *scantag,
const char *altscanpath[ALT_REPS_MAX],
const char *altscantag[ALT_REPS_MAX],
int arch)
{
/*#headerList **headerlist,
# struct headerSourceList *headersourcelist,
# struct providedList **firstprovided,
*/
int arch) {
struct headerList *currheaderlist, *newheaderlist, *currbrother;
struct providedList *provided;
struct headerList ** newprovider;
@ -1224,7 +1216,6 @@ addToHeaderList(struct configTag *ct,
currheaderlist = ct->headerlist[arch];
n = scansdir(scanpath, &namelist, rpmselector, scanrpmnamecmp);
if (n < 0) {
errstr = strerror(errno);
logmsg(LOG_ERROR, "%s: cannot scan directory '%s' (%s)", scantag, scanpath, errstr);
@ -1252,12 +1243,7 @@ addToHeaderList(struct configTag *ct,
}
while (1) {
/* if (cnt>=n) { break; }
for (i = 0; i < ALT_REPS_MAX; i++) {
if altcnt[i] >= altn[i]
}*/
/* check for duplicates in main repository */
if ((cnt < n - 1) &&
(!rpmnamecmp(namelist[cnt]->d_name,namelist[cnt+1]->d_name,0))) {
logmsg(LOG_WARNING, "%s: duplicated RPM package in %s repository (skipped)",namelist[cnt]->d_name, scantag);
@ -1306,7 +1292,6 @@ addToHeaderList(struct configTag *ct,
}
}
}
/* break while loop when no more packages are found */
if (currname[0] == '\0') { break; }
/* process package */
@ -1317,7 +1302,6 @@ addToHeaderList(struct configTag *ct,
logmsg(LOG_WARNING,
"%s: unable to read header (%s); skipping.",filename, errstr);
} else {
getPackageObsoletes(h, &obsoletename, &obsoleteflags,
&obsoleteversion, &obsoletecount);
getPackageProvides(h, &providename, &provideflags,
@ -1372,9 +1356,7 @@ addToHeaderList(struct configTag *ct,
}
currbrother->nextbrother = newheaderlist;
}
newheaderlist->recursed = 0;
if (currheaderlist) {
currheaderlist->next = newheaderlist;
}
@ -1384,12 +1366,9 @@ addToHeaderList(struct configTag *ct,
/* set first pointer of the list */
ct->headerlist[arch] = newheaderlist;
}
} else if (newheaderlist->sourcename) /* missing source header */ {
if ((!newheaderlist->sourceheader) ||
(newheaderlist->sourceheader->altrepository) <= altrepository)
{
(newheaderlist->sourceheader->altrepository) <= altrepository) {
logmsg(LOG_WARNING,"%s(%s,%s): missing SRPM %s-%s-%s; skipping.",
newheaderlist->name,
ct->arch[arch],
@ -1404,7 +1383,8 @@ addToHeaderList(struct configTag *ct,
newheaderlist->provided = malloc(sizeof(struct providedList*)*providecount);
for (i=0; i < providecount; i++) {
provided = findOrCreateProvidedListEntry((struct providedList **) &(ct->providedlist_idx[arch]),
provided = findOrCreateProvidedListEntry(
(struct providedList **) &(ct->providedlist_idx[arch]),
providename[i],1,arch);
newheaderlist->provided[i]=provided;
if (provided && (provided->numproviders == 0)) {
@ -1431,24 +1411,19 @@ addToHeaderList(struct configTag *ct,
newversion[provided->numproviders-1] = strdup(provideversion[i]);
free(provided->version);
provided->version=newversion;
} else {
fprintf(stderr,"%s has %d providers but is ignored\n",provided->name,provided->numproviders);
}
}
newheaderlist->providename = providename;
newheaderlist->provideflags = provideflags;
newheaderlist->provideversion = provideversion;
newheaderlist->providecount = providecount;
newheaderlist->obsoletename = obsoletename;
newheaderlist->obsoleteflags = obsoleteflags;
newheaderlist->obsoleteversion = obsoleteversion;
newheaderlist->obsoletecount = obsoletecount;
newheaderlist->altrepository = altrepository;
newheaderlist->require = malloc(requirecount * sizeof(struct Require *));
for (j=0; j < requirecount; j++) {
newheaderlist->require[j] = malloc(sizeof(struct Require));
@ -1458,7 +1433,6 @@ addToHeaderList(struct configTag *ct,
newheaderlist->require[j]->resolved = NULL;
}
newheaderlist->requirecount = requirecount;
newheaderlist->file =
malloc(sizeof(struct fileTree*) * filenamecount);
newheaderlist->fileflags =
@ -1485,11 +1459,11 @@ addToHeaderList(struct configTag *ct,
if (newheaderlist->file[j]->provider[k] == newheaderlist)
break;
}
/* if not add to the list of providers */
if (k == newheaderlist->file[j]->numproviders) {
newheaderlist->file[j]->numproviders++;
newprovider=malloc(sizeof(struct headerList*)*newheaderlist->file[j]->numproviders);
newprovider=malloc(
sizeof(struct headerList*)*newheaderlist->file[j]->numproviders);
for (k = 0; k < newheaderlist->file[j]->numproviders-1; k++) {
newprovider[k]=newheaderlist->file[j]->provider[k];
}
@ -1502,8 +1476,8 @@ addToHeaderList(struct configTag *ct,
newheaderlist->filenamecount = filenamecount;
(void) headerFree(h);
} // if getHeader()
if (altrepository > 0) {
free(altnamelist[altrepository-1][altcnt[altrepository-1]-1]); }
if (altrepository > 0)
free(altnamelist[altrepository-1][altcnt[altrepository-1]-1]);
else free(namelist[cnt-1]);
} // main while
#if RPM_VERSION >= 0x050000
@ -1552,6 +1526,5 @@ generateHeaderList(struct configTag* ct, int arch, int incremental)
logmsg(LOG_ERROR,"Error scanning RPMs repository");
return 1;
}
return 0;
}