summaryrefslogtreecommitdiff
path: root/build
diff options
context:
space:
mode:
authorjbj <devnull@localhost>2001-04-30 22:32:22 +0000
committerjbj <devnull@localhost>2001-04-30 22:32:22 +0000
commit0ecdbba93587408c670124e88d39451c681a77eb (patch)
tree0953710c0f014faf772aa6c1ab0fdc1933ffdd8c /build
parenta57a13b1350ff1a094c202c90391f8676f487582 (diff)
downloadlibrpm-tizen-0ecdbba93587408c670124e88d39451c681a77eb.tar.gz
librpm-tizen-0ecdbba93587408c670124e88d39451c681a77eb.tar.bz2
librpm-tizen-0ecdbba93587408c670124e88d39451c681a77eb.zip
- yet more boring lclint annotations and fiddles.
CVS patchset: 4732 CVS date: 2001/04/30 22:32:22
Diffstat (limited to 'build')
-rw-r--r--build/.lclintrc18
-rw-r--r--build/build.c23
-rw-r--r--build/expression.c4
-rw-r--r--build/files.c166
-rw-r--r--build/myftw.c6
-rw-r--r--build/names.c2
-rw-r--r--build/pack.c95
-rw-r--r--build/parseChangelog.c26
-rw-r--r--build/parseDescription.c2
-rw-r--r--build/parsePreamble.c44
-rw-r--r--build/parsePrep.c8
-rw-r--r--build/parseReqs.c6
-rw-r--r--build/parseScript.c16
-rw-r--r--build/parseSpec.c14
-rw-r--r--build/reqprov.c16
-rw-r--r--build/spec.c24
16 files changed, 251 insertions, 219 deletions
diff --git a/build/.lclintrc b/build/.lclintrc
index d52e965ab..42c8960fd 100644
--- a/build/.lclintrc
+++ b/build/.lclintrc
@@ -11,20 +11,14 @@
-unrecogcomments
# don't-bother-me-yet parameters
--branchstate
-#-immediatetrans
--mustfree
-#-observertrans
-#-statictrans
+-branchstate # ~39
+-mustfree # ~325
# not-yet normal parameters
--boolops # w->n
--fixedformalarray
--null
--predboolint # w->n
--predboolothers # w->n
--retvalint # w->n
--type
+-boolops # ~351 w->n
+#-null # ~68
+-predboolint # ~200 w->n
+-type # ~271
# -weak paramaters
diff --git a/build/build.c b/build/build.c
index ecda494ae..1505fb530 100644
--- a/build/build.c
+++ b/build/build.c
@@ -13,6 +13,7 @@
static int _build_debug = 0;
/*@access StringBuf @*/
+/*@access urlinfo @*/ /* XXX compared with NULL */
/*@access FD_t @*/
/**
@@ -29,7 +30,7 @@ static void doRmSource(Spec spec)
for (p = spec->sources; p != NULL; p = p->next) {
if (! (p->flags & RPMBUILD_ISNO)) {
const char *fn = rpmGetPath("%{_sourcedir}/", p->source, NULL);
- Unlink(fn);
+ (void) Unlink(fn);
fn = _free(fn);
}
}
@@ -38,7 +39,7 @@ static void doRmSource(Spec spec)
for (p = pkg->icon; p != NULL; p = p->next) {
if (! (p->flags & RPMBUILD_ISNO)) {
const char *fn = rpmGetPath("%{_sourcedir}/", p->source, NULL);
- Unlink(fn);
+ (void) Unlink(fn);
fn = _free(fn);
}
}
@@ -147,7 +148,7 @@ int doScript(Spec spec, int what, const char *name, StringBuf sb, int test)
buildTemplate = rpmExpand(mTemplate, NULL);
buildPost = rpmExpand(mPost, NULL);
- fputs(buildTemplate, fp);
+ (void) fputs(buildTemplate, fp);
if (what != RPMBUILD_PREP && what != RPMBUILD_RMBUILD && spec->buildSubdir)
fprintf(fp, "cd %s\n", spec->buildSubdir);
@@ -158,9 +159,9 @@ int doScript(Spec spec, int what, const char *name, StringBuf sb, int test)
} else
fprintf(fp, "%s", getStringBuf(sb));
- fputs(buildPost, fp);
+ (void) fputs(buildPost, fp);
- Fclose(xfd);
+ (void) Fclose(xfd);
if (test) {
rc = 0;
@@ -174,7 +175,7 @@ fprintf(stderr, "*** rootURL %s buildDirURL %s\n", rootURL, buildDirURL);
rc = RPMERR_SCRIPT;
goto exit;
}
- if (u) {
+ if (u != NULL) {
switch (u->urltype) {
case URL_IS_FTP:
if (_build_debug)
@@ -191,13 +192,13 @@ fprintf(stderr, "*** addMacros\n");
}
buildCmd = rpmExpand("%{___build_cmd}", " ", buildScript, NULL);
- poptParseArgvString(buildCmd, &argc, &argv);
+ (void) poptParseArgvString(buildCmd, &argc, &argv);
rpmMessage(RPMMESS_NORMAL, _("Executing(%s): %s\n"), name, buildCmd);
if (!(child = fork())) {
errno = 0;
- execvp(argv[0], (char *const *)argv);
+ (void) execvp(argv[0], (char *const *)argv);
rpmError(RPMERR_SCRIPT, _("Exec of %s failed (%s): %s\n"),
scriptName, name, strerror(errno));
@@ -217,10 +218,10 @@ fprintf(stderr, "*** addMacros\n");
exit:
if (scriptName) {
if (!rc)
- Unlink(scriptName);
+ (void) Unlink(scriptName);
scriptName = _free(scriptName);
}
- if (u) {
+ if (u != NULL) {
switch (u->urltype) {
case URL_IS_FTP:
case URL_IS_HTTP:
@@ -303,7 +304,7 @@ int buildSpec(Spec spec, int what, int test)
doRmSource(spec);
if (what & RPMBUILD_RMSPEC)
- Unlink(spec->specFile);
+ (void) Unlink(spec->specFile);
exit:
if (rc && rpmlogGetNrecs() > 0) {
diff --git a/build/expression.c b/build/expression.c
index abdfb3e2c..14b059bad 100644
--- a/build/expression.c
+++ b/build/expression.c
@@ -645,7 +645,7 @@ int parseExpressionBoolean(Spec spec, const char *expr)
state.spec = spec;
state.nextToken = 0;
state.tokenValue = NULL;
- rdToken(&state);
+ (void) rdToken(&state);
/* Parse the expression. */
v = doLogical(&state);
@@ -692,7 +692,7 @@ char * parseExpressionString(Spec spec, const char *expr)
state.spec = spec;
state.nextToken = 0;
state.tokenValue = NULL;
- rdToken(&state);
+ (void) rdToken(&state);
/* Parse the expression. */
v = doLogical(&state);
diff --git a/build/files.c b/build/files.c
index 1b8fa9a3d..b58615560 100644
--- a/build/files.c
+++ b/build/files.c
@@ -247,8 +247,8 @@ static void timeCheck(int tc, Header h)
int count, x;
time_t currentTime = time(NULL);
- hge(h, RPMTAG_OLDFILENAMES, &fnt, (void **) &files, &count);
- hge(h, RPMTAG_FILEMTIMES, NULL, (void **) &mtime, NULL);
+ (void) hge(h, RPMTAG_OLDFILENAMES, &fnt, (void **) &files, &count);
+ (void) hge(h, RPMTAG_FILEMTIMES, NULL, (void **) &mtime, NULL);
for (x = 0; x < count; x++) {
if ((currentTime - mtime[x]) > tc)
@@ -331,13 +331,13 @@ static int parseForVerify(char *buf, FileList fl)
not = 0;
verifyFlags = RPMVERIFY_NONE;
- for (p = q; *p; p = pe) {
+ for (p = q; *p != '\0'; p = pe) {
SKIPWHITE(p);
if (*p == '\0')
break;
pe = p;
SKIPNONWHITE(pe);
- if (*pe)
+ if (*pe != '\0')
*pe++ = '\0';
{ VFA_t *vfa;
@@ -409,7 +409,7 @@ static int parseForAttr(char *buf, FileList fl)
q = pe;
q++;
SKIPSPACE(q);
- if (*q) {
+ if (*q != '\0') {
rpmError(RPMERR_BADSPEC,
_("Non-white space follows %s(): %s\n"), name, q);
fl->processingFailed = 1;
@@ -427,23 +427,23 @@ static int parseForAttr(char *buf, FileList fl)
nullAttrRec(ar);
p = q; SKIPWHITE(p);
- if (*p) {
- pe = p; SKIPNONWHITE(pe); if (*pe) *pe++ = '\0';
+ if (*p != '\0') {
+ pe = p; SKIPNONWHITE(pe); if (*pe != '\0') *pe++ = '\0';
ar->ar_fmodestr = p;
p = pe; SKIPWHITE(p);
}
- if (*p) {
- pe = p; SKIPNONWHITE(pe); if (*pe) *pe++ = '\0';
+ if (*p != '\0') {
+ pe = p; SKIPNONWHITE(pe); if (*pe != '\0') *pe++ = '\0';
ar->ar_user = p;
p = pe; SKIPWHITE(p);
}
- if (*p) {
- pe = p; SKIPNONWHITE(pe); if (*pe) *pe++ = '\0';
+ if (*p != '\0') {
+ pe = p; SKIPNONWHITE(pe); if (*pe != '\0') *pe++ = '\0';
ar->ar_group = p;
p = pe; SKIPWHITE(p);
}
- if (*p && ret_ar == &(fl->def_ar)) { /* %defattr */
- pe = p; SKIPNONWHITE(pe); if (*pe) *pe++ = '\0';
+ if (*p != '\0' && ret_ar == &(fl->def_ar)) { /* %defattr */
+ pe = p; SKIPNONWHITE(pe); if (*pe != '\0') *pe++ = '\0';
ar->ar_dmodestr = p;
p = pe; SKIPWHITE(p);
}
@@ -530,13 +530,13 @@ static int parseForConfig(char *buf, FileList fl)
while (p <= pe)
*p++ = ' ';
- for (p = q; *p; p = pe) {
+ for (p = q; *p != '\0'; p = pe) {
SKIPWHITE(p);
if (*p == '\0')
break;
pe = p;
SKIPNONWHITE(pe);
- if (*pe)
+ if (*pe != '\0')
*pe++ = '\0';
if (!strcmp(p, "missingok")) {
fl->currentFlags |= RPMFILE_MISSINGOK;
@@ -597,7 +597,7 @@ static int parseForLang(char *buf, FileList fl)
*p++ = ' ';
/* Parse multiple arguments from %lang */
- for (p = q; *p; p = pe) {
+ for (p = q; *p != '\0'; p = pe) {
char *newp;
size_t np;
int i;
@@ -828,7 +828,7 @@ static int parseForSimple(/*@unused@*/Spec spec, Package pkg, char *buf,
/* XXX WATCHOUT: buf is an arg */
{ const char *ddir, *n, *v;
- headerNVR(pkg->header, &n, &v, NULL);
+ (void) headerNVR(pkg->header, &n, &v, NULL);
ddir = rpmGetPath("%{_docdir}/", n, "-", v, NULL);
strcpy(buf, ddir);
@@ -1058,65 +1058,65 @@ static void genCpioListAndHeader(/*@partial@*/ FileList fl,
* compressed file list write before we write the actual package to
* disk.
*/
- headerAddOrAppendEntry(h, RPMTAG_OLDFILENAMES, RPM_STRING_ARRAY_TYPE,
+ (void) headerAddOrAppendEntry(h, RPMTAG_OLDFILENAMES, RPM_STRING_ARRAY_TYPE,
&(flp->fileURL), 1);
if (sizeof(flp->fl_size) != sizeof(uint_32)) {
uint_32 psize = (uint_32)flp->fl_size;
- headerAddOrAppendEntry(h, RPMTAG_FILESIZES, RPM_INT32_TYPE,
+ (void) headerAddOrAppendEntry(h, RPMTAG_FILESIZES, RPM_INT32_TYPE,
&(psize), 1);
} else {
- headerAddOrAppendEntry(h, RPMTAG_FILESIZES, RPM_INT32_TYPE,
+ (void) headerAddOrAppendEntry(h, RPMTAG_FILESIZES, RPM_INT32_TYPE,
&(flp->fl_size), 1);
}
- headerAddOrAppendEntry(h, RPMTAG_FILEUSERNAME, RPM_STRING_ARRAY_TYPE,
+ (void) headerAddOrAppendEntry(h, RPMTAG_FILEUSERNAME, RPM_STRING_ARRAY_TYPE,
&(flp->uname), 1);
- headerAddOrAppendEntry(h, RPMTAG_FILEGROUPNAME, RPM_STRING_ARRAY_TYPE,
+ (void) headerAddOrAppendEntry(h, RPMTAG_FILEGROUPNAME, RPM_STRING_ARRAY_TYPE,
&(flp->gname), 1);
- headerAddOrAppendEntry(h, RPMTAG_FILEMTIMES, RPM_INT32_TYPE,
+ (void) headerAddOrAppendEntry(h, RPMTAG_FILEMTIMES, RPM_INT32_TYPE,
&(flp->fl_mtime), 1);
if (sizeof(flp->fl_mode) != sizeof(uint_16)) {
uint_16 pmode = (uint_16)flp->fl_mode;
- headerAddOrAppendEntry(h, RPMTAG_FILEMODES, RPM_INT16_TYPE,
+ (void) headerAddOrAppendEntry(h, RPMTAG_FILEMODES, RPM_INT16_TYPE,
&(pmode), 1);
} else {
- headerAddOrAppendEntry(h, RPMTAG_FILEMODES, RPM_INT16_TYPE,
+ (void) headerAddOrAppendEntry(h, RPMTAG_FILEMODES, RPM_INT16_TYPE,
&(flp->fl_mode), 1);
}
if (sizeof(flp->fl_rdev) != sizeof(uint_16)) {
uint_16 prdev = (uint_16)flp->fl_rdev;
- headerAddOrAppendEntry(h, RPMTAG_FILERDEVS, RPM_INT16_TYPE,
+ (void) headerAddOrAppendEntry(h, RPMTAG_FILERDEVS, RPM_INT16_TYPE,
&(prdev), 1);
} else {
- headerAddOrAppendEntry(h, RPMTAG_FILERDEVS, RPM_INT16_TYPE,
+ (void) headerAddOrAppendEntry(h, RPMTAG_FILERDEVS, RPM_INT16_TYPE,
&(flp->fl_rdev), 1);
}
if (sizeof(flp->fl_dev) != sizeof(uint_32)) {
uint_32 pdevice = (uint_32)flp->fl_dev;
- headerAddOrAppendEntry(h, RPMTAG_FILEDEVICES, RPM_INT32_TYPE,
+ (void) headerAddOrAppendEntry(h, RPMTAG_FILEDEVICES, RPM_INT32_TYPE,
&(pdevice), 1);
} else {
- headerAddOrAppendEntry(h, RPMTAG_FILEDEVICES, RPM_INT32_TYPE,
+ (void) headerAddOrAppendEntry(h, RPMTAG_FILEDEVICES, RPM_INT32_TYPE,
&(flp->fl_dev), 1);
}
- headerAddOrAppendEntry(h, RPMTAG_FILEINODES, RPM_INT32_TYPE,
+ (void) headerAddOrAppendEntry(h, RPMTAG_FILEINODES, RPM_INT32_TYPE,
&(flp->fl_ino), 1);
- headerAddOrAppendEntry(h, RPMTAG_FILELANGS, RPM_STRING_ARRAY_TYPE,
+ (void) headerAddOrAppendEntry(h, RPMTAG_FILELANGS, RPM_STRING_ARRAY_TYPE,
&(flp->langs), 1);
/* We used to add these, but they should not be needed */
- /* headerAddOrAppendEntry(h, RPMTAG_FILEUIDS,
+ /* (void) headerAddOrAppendEntry(h, RPMTAG_FILEUIDS,
* RPM_INT32_TYPE, &(flp->fl_uid), 1);
- * headerAddOrAppendEntry(h, RPMTAG_FILEGIDS,
+ * (void) headerAddOrAppendEntry(h, RPMTAG_FILEGIDS,
* RPM_INT32_TYPE, &(flp->fl_gid), 1);
*/
buf[0] = '\0';
if (S_ISREG(flp->fl_mode))
- mdfile(flp->diskURL, buf);
+ (void) mdfile(flp->diskURL, buf);
s = buf;
- headerAddOrAppendEntry(h, RPMTAG_FILEMD5S, RPM_STRING_ARRAY_TYPE,
+ (void) headerAddOrAppendEntry(h, RPMTAG_FILEMD5S, RPM_STRING_ARRAY_TYPE,
&s, 1);
buf[0] = '\0';
@@ -1136,14 +1136,14 @@ static void genCpioListAndHeader(/*@partial@*/ FileList fl,
}
}
s = buf;
- headerAddOrAppendEntry(h, RPMTAG_FILELINKTOS, RPM_STRING_ARRAY_TYPE,
+ (void) headerAddOrAppendEntry(h, RPMTAG_FILELINKTOS, RPM_STRING_ARRAY_TYPE,
&s, 1);
if (flp->flags & RPMFILE_GHOST) {
flp->verifyFlags &= ~(RPMVERIFY_MD5 | RPMVERIFY_FILESIZE |
RPMVERIFY_LINKTO | RPMVERIFY_MTIME);
}
- headerAddOrAppendEntry(h, RPMTAG_FILEVERIFYFLAGS, RPM_INT32_TYPE,
+ (void) headerAddOrAppendEntry(h, RPMTAG_FILEVERIFYFLAGS, RPM_INT32_TYPE,
&(flp->verifyFlags), 1);
if (!isSrc && isDoc(fl, flp->fileURL))
@@ -1152,11 +1152,11 @@ static void genCpioListAndHeader(/*@partial@*/ FileList fl,
if (S_ISDIR(flp->fl_mode))
flp->flags &= ~(RPMFILE_CONFIG|RPMFILE_DOC);
- headerAddOrAppendEntry(h, RPMTAG_FILEFLAGS, RPM_INT32_TYPE,
+ (void) headerAddOrAppendEntry(h, RPMTAG_FILEFLAGS, RPM_INT32_TYPE,
&(flp->flags), 1);
}
- headerAddEntry(h, RPMTAG_SIZE, RPM_INT32_TYPE,
+ (void) headerAddEntry(h, RPMTAG_SIZE, RPM_INT32_TYPE,
&(fl->totalFileSize), 1);
/* XXX This should be added always so that packages look alike.
@@ -1164,11 +1164,11 @@ static void genCpioListAndHeader(/*@partial@*/ FileList fl,
* XXX existence (rather than value) that will need to change as well.
*/
if (multiLibMask)
- headerAddEntry(h, RPMTAG_MULTILIBS, RPM_INT32_TYPE,
+ (void) headerAddEntry(h, RPMTAG_MULTILIBS, RPM_INT32_TYPE,
&multiLibMask, 1);
if (_addDotSlash)
- rpmlibNeedsFeature(h, "PayloadFilesHavePrefix", "4.0-1");
+ (void) rpmlibNeedsFeature(h, "PayloadFilesHavePrefix", "4.0-1");
/* Choose how filenames are represented. */
if (_noDirTokens)
@@ -1176,7 +1176,7 @@ static void genCpioListAndHeader(/*@partial@*/ FileList fl,
else {
compressFilelist(h);
/* Binary packages with dirNames cannot be installed by legacy rpm. */
- rpmlibNeedsFeature(h, "CompressedFileNames", "3.0.4-1");
+ (void) rpmlibNeedsFeature(h, "CompressedFileNames", "3.0.4-1");
}
{ TFI_t fi = xcalloc(sizeof(*fi), 1);
@@ -1336,7 +1336,7 @@ static int addFile(FileList fl, const char * diskURL, struct stat *statp)
fl->inFtw = 1; /* Flag to indicate file has buildRootURL prefixed */
fl->isDir = 1; /* Keep it from following myftw() again */
- myftw(diskURL, 16, (myftwFunc) addFile, fl);
+ (void) myftw(diskURL, 16, (myftwFunc) addFile, fl);
fl->isDir = 0;
fl->inFtw = 0;
return 0;
@@ -1379,7 +1379,7 @@ static int addFile(FileList fl, const char * diskURL, struct stat *statp)
#endif
rpmMessage(RPMMESS_DEBUG, _("File %4d: %07o %s.%s\t %s\n"), fl->fileCount,
- fileMode, fileUname, fileGname, fileURL);
+ (unsigned)fileMode, fileUname, fileGname, fileURL);
/* Add to the file list */
if (fl->fileListRecsUsed == fl->fileListRecsAlloced) {
@@ -1412,7 +1412,7 @@ static int addFile(FileList fl, const char * diskURL, struct stat *statp)
for (i = 0; i < fl->nLangs; i++) {
const char *ocl;
if (i) *ncl++ = '|';
- for (ocl = fl->currentLangs[i]; *ocl; ocl++)
+ for (ocl = fl->currentLangs[i]; *ocl != '\0'; ocl++)
*ncl++ = *ocl;
*ncl = '\0';
}
@@ -1557,7 +1557,7 @@ static int processPackageFiles(Spec spec, Package pkg,
}
appendStringBuf(pkg->fileList, buf);
}
- Fclose(fd);
+ (void) Fclose(fd);
}
/* Init the file list structure */
@@ -1632,7 +1632,9 @@ static int processPackageFiles(Spec spec, Package pkg,
if (fl.currentLangs) {
int i;
for (i = 0; i < fl.nLangs; i++)
+ /*@-unqualifiedtrans@*/
fl.currentLangs[i] = _free(fl.currentLangs[i]);
+ /*@=unqualifiedtrans@*/
fl.currentLangs = _free(fl.currentLangs);
}
fl.nLangs = 0;
@@ -1658,14 +1660,14 @@ static int processPackageFiles(Spec spec, Package pkg,
specialDoc = xstrdup(fileName);
dupAttrRec(&fl.cur_ar, specialDocAttrRec);
} else {
- processBinaryFile(pkg, &fl, fileName);
+ (void) processBinaryFile(pkg, &fl, fileName);
}
}
/* Now process special doc, if there is one */
if (specialDoc) {
if (installSpecialDoc) {
- doScript(spec, RPMBUILD_STRINGBUF, "%doc", pkg->specialDoc, test);
+ (void) doScript(spec, RPMBUILD_STRINGBUF, "%doc", pkg->specialDoc, test);
}
/* Reset for %doc */
@@ -1678,7 +1680,9 @@ static int processPackageFiles(Spec spec, Package pkg,
if (fl.currentLangs) {
int i;
for (i = 0; i < fl.nLangs; i++)
+ /*@-unqualifiedtrans@*/
fl.currentLangs[i] = _free(fl.currentLangs[i]);
+ /*@=unqualifiedtrans@*/
fl.currentLangs = _free(fl.currentLangs);
}
fl.nLangs = 0;
@@ -1686,7 +1690,7 @@ static int processPackageFiles(Spec spec, Package pkg,
dupAttrRec(specialDocAttrRec, &fl.cur_ar);
freeAttrRec(specialDocAttrRec);
- processBinaryFile(pkg, &fl, specialDoc);
+ (void) processBinaryFile(pkg, &fl, specialDoc);
specialDoc = _free(specialDoc);
}
@@ -1714,7 +1718,9 @@ exit:
if (fl.currentLangs) {
int i;
for (i = 0; i < fl.nLangs; i++)
+ /*@-unqualifiedtrans@*/
fl.currentLangs[i] = _free(fl.currentLangs[i]);
+ /*@=unqualifiedtrans@*/
fl.currentLangs = _free(fl.currentLangs);
}
@@ -1756,7 +1762,7 @@ void initSourceHeader(Spec spec)
case RPMTAG_CHANGELOGTEXT:
case RPMTAG_URL:
case HEADER_I18NTABLE:
- headerAddEntry(spec->sourceHeader, tag, type, ptr, count);
+ (void) headerAddEntry(spec->sourceHeader, tag, type, ptr, count);
break;
default:
/* do not copy */
@@ -1770,12 +1776,12 @@ void initSourceHeader(Spec spec)
headerNextIterator(hi, &tag, &type, &ptr, &count);
ptr = headerFreeData(ptr, type))
{
- headerAddEntry(spec->sourceHeader, tag, type, ptr, count);
+ (void) headerAddEntry(spec->sourceHeader, tag, type, ptr, count);
}
headerFreeIterator(hi);
if (spec->buildArchitectureCount) {
- headerAddEntry(spec->sourceHeader, RPMTAG_BUILDARCHS,
+ (void) headerAddEntry(spec->sourceHeader, RPMTAG_BUILDARCHS,
RPM_STRING_ARRAY_TYPE,
spec->buildArchitectures, spec->buildArchitectureCount);
}
@@ -1803,18 +1809,18 @@ int processSourceFiles(Spec spec)
appendLineStringBuf(sourceFiles, spec->specFile);
for (srcPtr = spec->sources; srcPtr != NULL; srcPtr = srcPtr->next) {
if (srcPtr->flags & RPMBUILD_ISSOURCE) {
- headerAddOrAppendEntry(spec->sourceHeader, RPMTAG_SOURCE,
+ (void) headerAddOrAppendEntry(spec->sourceHeader, RPMTAG_SOURCE,
RPM_STRING_ARRAY_TYPE, &srcPtr->source, 1);
if (srcPtr->flags & RPMBUILD_ISNO) {
- headerAddOrAppendEntry(spec->sourceHeader, RPMTAG_NOSOURCE,
+ (void) headerAddOrAppendEntry(spec->sourceHeader, RPMTAG_NOSOURCE,
RPM_INT32_TYPE, &srcPtr->num, 1);
}
}
if (srcPtr->flags & RPMBUILD_ISPATCH) {
- headerAddOrAppendEntry(spec->sourceHeader, RPMTAG_PATCH,
+ (void) headerAddOrAppendEntry(spec->sourceHeader, RPMTAG_PATCH,
RPM_STRING_ARRAY_TYPE, &srcPtr->source, 1);
if (srcPtr->flags & RPMBUILD_ISNO) {
- headerAddOrAppendEntry(spec->sourceHeader, RPMTAG_NOPATCH,
+ (void) headerAddOrAppendEntry(spec->sourceHeader, RPMTAG_NOPATCH,
RPM_INT32_TYPE, &srcPtr->num, 1);
}
}
@@ -1929,25 +1935,25 @@ static StringBuf getOutputFrom(char *dir, char *argv[],
oldhandler = signal(SIGPIPE, SIG_IGN);
toProg[0] = toProg[1] = 0;
- pipe(toProg);
+ (void) pipe(toProg);
fromProg[0] = fromProg[1] = 0;
- pipe(fromProg);
+ (void) pipe(fromProg);
if (!(progPID = fork())) {
- close(toProg[1]);
- close(fromProg[0]);
+ (void) close(toProg[1]);
+ (void) close(fromProg[0]);
- dup2(toProg[0], STDIN_FILENO); /* Make stdin the in pipe */
- dup2(fromProg[1], STDOUT_FILENO); /* Make stdout the out pipe */
+ (void) dup2(toProg[0], STDIN_FILENO); /* Make stdin the in pipe */
+ (void) dup2(fromProg[1], STDOUT_FILENO); /* Make stdout the out pipe */
- close(toProg[0]);
- close(fromProg[1]);
+ (void) close(toProg[0]);
+ (void) close(fromProg[1]);
if (dir) {
- chdir(dir);
+ (void) chdir(dir);
}
- execvp(argv[0], argv);
+ (void) execvp(argv[0], argv);
/* XXX this error message is probably not seen. */
rpmError(RPMERR_EXEC, _("Couldn't exec %s: %s\n"),
argv[0], strerror(errno));
@@ -1959,12 +1965,12 @@ static StringBuf getOutputFrom(char *dir, char *argv[],
return NULL;
}
- close(toProg[0]);
- close(fromProg[1]);
+ (void) close(toProg[0]);
+ (void) close(fromProg[1]);
/* Do not block reading or writing from/to prog. */
- fcntl(fromProg[0], F_SETFL, O_NONBLOCK);
- fcntl(toProg[1], F_SETFL, O_NONBLOCK);
+ (void) fcntl(fromProg[0], F_SETFL, O_NONBLOCK);
+ (void) fcntl(toProg[1], F_SETFL, O_NONBLOCK);
readBuff = newStringBuf();
@@ -2008,7 +2014,7 @@ top:
writeBytesLeft -= nbw;
writePtr += nbw;
} else if (toProg[1] >= 0) { /* close write fd */
- close(toProg[1]);
+ (void) close(toProg[1]);
toProg[1] = -1;
}
}
@@ -2028,10 +2034,10 @@ top:
/* Clean up */
if (toProg[1] >= 0)
- close(toProg[1]);
+ (void) close(toProg[1]);
if (fromProg[0] >= 0)
- close(fromProg[0]);
- (void)signal(SIGPIPE, oldhandler);
+ (void) close(fromProg[0]);
+ (void) signal(SIGPIPE, oldhandler);
/* Collect status from prog */
(void)waitpid(progPID, &status, 0);
@@ -2290,7 +2296,7 @@ static void printDeps(Header h)
break;
default:
versions = hfd(versions, dvt);
- hge(h, dm->vtag, &dvt, (void **) &versions, NULL);
+ (void) hge(h, dm->vtag, &dvt, (void **) &versions, NULL);
break;
}
switch (dm->ftag) {
@@ -2300,7 +2306,7 @@ static void printDeps(Header h)
case -1:
break;
default:
- hge(h, dm->ftag, NULL, (void **) &flags, NULL);
+ (void) hge(h, dm->ftag, NULL, (void **) &flags, NULL);
break;
}
printDepMsg(dm, count, names, versions, flags);
@@ -2321,7 +2327,7 @@ int processBinaryFiles(Spec spec, int installSpecialDoc, int test)
if (pkg->fileList == NULL)
continue;
- headerNVR(pkg->header, &n, &v, &r);
+ (void) headerNVR(pkg->header, &n, &v, &r);
rpmMessage(RPMMESS_NORMAL, _("Processing files: %s-%s-%s\n"), n, v, r);
if ((rc = processPackageFiles(spec, pkg, installSpecialDoc, test)))
@@ -2332,10 +2338,10 @@ int processBinaryFiles(Spec spec, int installSpecialDoc, int test)
* XXX existence (rather than value) that will need to change as well.
*/
if (headerIsEntry(pkg->header, RPMTAG_MULTILIBS)) {
- generateDepends(spec, pkg, pkg->cpioList, 1);
- generateDepends(spec, pkg, pkg->cpioList, 2);
+ (void) generateDepends(spec, pkg, pkg->cpioList, 1);
+ (void) generateDepends(spec, pkg, pkg->cpioList, 2);
} else
- generateDepends(spec, pkg, pkg->cpioList, 0);
+ (void) generateDepends(spec, pkg, pkg->cpioList, 0);
printDeps(pkg->header);
}
diff --git a/build/myftw.c b/build/myftw.c
index 976a7f883..b58a52908 100644
--- a/build/myftw.c
+++ b/build/myftw.c
@@ -107,7 +107,7 @@ myftw_dir (DIR **dirs, int level, int descriptors,
newlev = (level + 1) % descriptors;
if (dirs[newlev] != NULL)
- Closedir (dirs[newlev]);
+ (void) Closedir (dirs[newlev]);
dirs[newlev] = Opendir (dir);
if (dirs[newlev] != NULL)
@@ -134,7 +134,7 @@ myftw_dir (DIR **dirs, int level, int descriptors,
int save;
save = errno;
- Closedir (dirs[newlev]);
+ (void) Closedir (dirs[newlev]);
errno = save;
dirs[newlev] = NULL;
}
@@ -228,7 +228,7 @@ int myftw (const char *dir,
int save;
save = errno;
- Closedir (dirs[0]);
+ (void) Closedir (dirs[0]);
errno = save;
}
}
diff --git a/build/names.c b/build/names.c
index da2787ac5..03e08dc0d 100644
--- a/build/names.c
+++ b/build/names.c
@@ -126,7 +126,7 @@ const char *const buildHost(void)
struct hostent *hbn;
if (! gotit) {
- gethostname(hostname, sizeof(hostname));
+ (void) gethostname(hostname, sizeof(hostname));
if ((hbn = /*@-unrecog@*/ gethostbyname(hostname) /*@=unrecog@*/ ))
strcpy(hostname, hbn->h_name);
else
diff --git a/build/pack.c b/build/pack.c
index 43fc29a23..8baf97118 100644
--- a/build/pack.c
+++ b/build/pack.c
@@ -29,7 +29,7 @@ static inline int genSourceRpmName(Spec spec)
const char *name, *version, *release;
char fileName[BUFSIZ];
- headerNVR(spec->packages->header, &name, &version, &release);
+ (void) headerNVR(spec->packages->header, &name, &version, &release);
sprintf(fileName, "%s-%s-%s.%ssrc.rpm", name, version, release,
spec->noSource ? "no" : "");
spec->sourceRpmName = xstrdup(fileName);
@@ -60,7 +60,7 @@ static int cpio_doio(FD_t fdo, /*@unused@*/ Header h, CSA_t * csa,
rc = fsmSetup(fi->fsm, FSM_PKGBUILD, ts, fi, cfd,
&csa->cpioArchiveSize, &failedFile);
- Fclose(cfd);
+ (void) Fclose(cfd);
(void) fsmTeardown(fi->fsm);
if (rc) {
@@ -101,10 +101,12 @@ static int cpio_copy(FD_t fdo, CSA_t *csa)
/**
*/
-static StringBuf addFileToTagAux(Spec spec, const char *file, StringBuf sb)
+static /*@only@*/ /*@null@*/ StringBuf addFileToTagAux(Spec spec,
+ const char * file, /*@only@*/ StringBuf sb)
{
char buf[BUFSIZ];
- const char *fn = buf;
+ const char * fn = buf;
+ FILE * f;
FD_t fd;
/* XXX use rpmGenPath(rootdir, "%{_buildir}/%{_buildsubdir}/", file) */
@@ -116,15 +118,18 @@ static StringBuf addFileToTagAux(Spec spec, const char *file, StringBuf sb)
freeStringBuf(sb);
return NULL;
}
- while (fgets(buf, sizeof(buf), (FILE *)fdGetFp(fd))) {
+ f = fdGetFp(fd);
+ while (fgets(buf, sizeof(buf), f)) {
/* XXX display fn in error msg */
if (expandMacros(spec, spec->macros, buf, sizeof(buf))) {
rpmError(RPMERR_BADSPEC, _("line: %s\n"), buf);
- return NULL;
+ freeStringBuf(sb);
+ sb = NULL;
+ break;
}
appendStringBuf(sb, buf);
}
- Fclose(fd);
+ (void) Fclose(fd);
return sb;
}
@@ -139,13 +144,13 @@ static int addFileToTag(Spec spec, const char * file, Header h, int tag)
if (hge(h, tag, NULL, (void **)&s, NULL)) {
appendLineStringBuf(sb, s);
- headerRemoveEntry(h, tag);
+ (void) headerRemoveEntry(h, tag);
}
if ((sb = addFileToTagAux(spec, file, sb)) == NULL)
return 1;
- headerAddEntry(h, tag, RPM_STRING_TYPE, getStringBuf(sb), 1);
+ (void) headerAddEntry(h, tag, RPM_STRING_TYPE, getStringBuf(sb), 1);
freeStringBuf(sb);
return 0;
@@ -162,7 +167,7 @@ static int addFileToArrayTag(Spec spec, const char *file, Header h, int tag)
return 1;
s = getStringBuf(sb);
- headerAddOrAppendEntry(h, tag, RPM_STRING_ARRAY_TYPE, &s, 1);
+ (void) headerAddOrAppendEntry(h, tag, RPM_STRING_ARRAY_TYPE, &s, 1);
freeStringBuf(sb);
return 0;
@@ -212,10 +217,10 @@ static int processScriptFiles(Spec spec, Package pkg)
}
for (p = pkg->triggerFiles; p != NULL; p = p->next) {
- headerAddOrAppendEntry(pkg->header, RPMTAG_TRIGGERSCRIPTPROG,
+ (void) headerAddOrAppendEntry(pkg->header, RPMTAG_TRIGGERSCRIPTPROG,
RPM_STRING_ARRAY_TYPE, &(p->prog), 1);
if (p->script) {
- headerAddOrAppendEntry(pkg->header, RPMTAG_TRIGGERSCRIPTS,
+ (void) headerAddOrAppendEntry(pkg->header, RPMTAG_TRIGGERSCRIPTS,
RPM_STRING_ARRAY_TYPE, &(p->script), 1);
} else if (p->fileName) {
if (addFileToArrayTag(spec, p->fileName, pkg->header,
@@ -229,7 +234,7 @@ static int processScriptFiles(Spec spec, Package pkg)
/* This is dumb. When the header supports NULL string */
/* this will go away. */
char *bull = "";
- headerAddOrAppendEntry(pkg->header, RPMTAG_TRIGGERSCRIPTS,
+ (void) headerAddOrAppendEntry(pkg->header, RPMTAG_TRIGGERSCRIPTS,
RPM_STRING_ARRAY_TYPE, &bull, 1);
}
}
@@ -301,7 +306,7 @@ int readRPM(const char *fileName, Spec *specp, struct rpmlead *lead, Header *sig
if (csa)
csa->cpioFdIn = fdi;
else
- Fclose(fdi);
+ (void) Fclose(fdi);
return 0;
}
@@ -322,7 +327,7 @@ int writeRPM(Header *hdrp, const char *fileName, int type,
if (Fileno(csa->cpioFdIn) < 0) {
csa->cpioArchiveSize = 0;
/* Add a bogus archive size to the Header */
- headerAddEntry(h, RPMTAG_ARCHIVESIZE, RPM_INT32_TYPE,
+ (void) headerAddEntry(h, RPMTAG_ARCHIVESIZE, RPM_INT32_TYPE,
&csa->cpioArchiveSize, 1);
}
@@ -357,26 +362,26 @@ int writeRPM(Header *hdrp, const char *fileName, int type,
}
s = strchr(rpmio_flags, '.');
if (s) {
- headerAddEntry(h, RPMTAG_PAYLOADFORMAT, RPM_STRING_TYPE, "cpio", 1);
+ (void) headerAddEntry(h, RPMTAG_PAYLOADFORMAT, RPM_STRING_TYPE, "cpio", 1);
if (s[1] == 'g' && s[2] == 'z')
- headerAddEntry(h, RPMTAG_PAYLOADCOMPRESSOR, RPM_STRING_TYPE,
+ (void) headerAddEntry(h, RPMTAG_PAYLOADCOMPRESSOR, RPM_STRING_TYPE,
"gzip", 1);
if (s[1] == 'b' && s[2] == 'z') {
- headerAddEntry(h, RPMTAG_PAYLOADCOMPRESSOR, RPM_STRING_TYPE,
+ (void) headerAddEntry(h, RPMTAG_PAYLOADCOMPRESSOR, RPM_STRING_TYPE,
"bzip2", 1);
/* Add prereq on rpm version that understands bzip2 payloads */
- rpmlibNeedsFeature(h, "PayloadIsBzip2", "3.0.5-1");
+ (void) rpmlibNeedsFeature(h, "PayloadIsBzip2", "3.0.5-1");
}
strcpy(buf, rpmio_flags);
buf[s - rpmio_flags] = '\0';
- headerAddEntry(h, RPMTAG_PAYLOADFLAGS, RPM_STRING_TYPE, buf+1, 1);
+ (void) headerAddEntry(h, RPMTAG_PAYLOADFLAGS, RPM_STRING_TYPE, buf+1, 1);
}
/* Create and add the cookie */
if (cookie) {
sprintf(buf, "%s %d", buildHost(), (int) time(NULL));
*cookie = xstrdup(buf);
- headerAddEntry(h, RPMTAG_COOKIE, RPM_STRING_TYPE, *cookie, 1);
+ (void) headerAddEntry(h, RPMTAG_COOKIE, RPM_STRING_TYPE, *cookie, 1);
}
/* Reallocate the header into one contiguous region. */
@@ -428,21 +433,21 @@ int writeRPM(Header *hdrp, const char *fileName, int type,
if (headerWrite(fd, h, HEADER_MAGIC_YES))
rc = RPMERR_NOSPACE;
- Fclose(fd);
+ (void) Fclose(fd);
fd = NULL;
- Unlink(fileName);
+ (void) Unlink(fileName);
if (rc)
goto exit;
/* Generate the signature */
- fflush(stdout);
+ (void) fflush(stdout);
sig = rpmNewSignature();
- rpmAddSignature(sig, sigtarget, RPMSIGTAG_SIZE, passPhrase);
- rpmAddSignature(sig, sigtarget, RPMSIGTAG_MD5, passPhrase);
+ (void) rpmAddSignature(sig, sigtarget, RPMSIGTAG_SIZE, passPhrase);
+ (void) rpmAddSignature(sig, sigtarget, RPMSIGTAG_MD5, passPhrase);
if ((sigtype = rpmLookupSignatureType(RPMLOOKUPSIG_QUERY)) > 0) {
rpmMessage(RPMMESS_NORMAL, _("Generating signature: %d\n"), sigtype);
- rpmAddSignature(sig, sigtarget, sigtype, passPhrase);
+ (void) rpmAddSignature(sig, sigtarget, sigtype, passPhrase);
}
/* Reallocate the signature into one contiguous region. */
@@ -482,7 +487,7 @@ int writeRPM(Header *hdrp, const char *fileName, int type,
lead.signature_type = RPMSIGTYPE_HEADERSIG;
{ const char *name, *version, *release;
- headerNVR(h, &name, &version, &release);
+ (void) headerNVR(h, &name, &version, &release);
sprintf(buf, "%s-%s-%s", name, version, release);
strncpy(lead.name, buf, sizeof(lead.name));
}
@@ -520,7 +525,7 @@ int writeRPM(Header *hdrp, const char *fileName, int type,
}
#ifdef NOTYET
- headerMergeLegacySigs(nh, sig);
+ (void) headerMergeLegacySigs(nh, sig);
#endif
rc = headerWrite(fd, nh, HEADER_MAGIC_YES);
@@ -557,22 +562,22 @@ exit:
sig = NULL;
}
if (ifd) {
- Fclose(ifd);
+ (void) Fclose(ifd);
ifd = NULL;
}
if (fd) {
- Fclose(fd);
+ (void) Fclose(fd);
fd = NULL;
}
if (sigtarget) {
- Unlink(sigtarget);
+ (void) Unlink(sigtarget);
sigtarget = _free(sigtarget);
}
if (rc == 0)
rpmMessage(RPMMESS_NORMAL, _("Wrote: %s\n"), fileName);
else
- Unlink(fileName);
+ (void) Unlink(fileName);
return rc;
}
@@ -601,30 +606,30 @@ int packageBinaries(Spec spec)
return rc;
if (spec->cookie) {
- headerAddEntry(pkg->header, RPMTAG_COOKIE,
+ (void) headerAddEntry(pkg->header, RPMTAG_COOKIE,
RPM_STRING_TYPE, spec->cookie, 1);
}
/* Copy changelog from src rpm */
headerCopyTags(spec->packages->header, pkg->header, copyTags);
- headerAddEntry(pkg->header, RPMTAG_RPMVERSION,
+ (void) headerAddEntry(pkg->header, RPMTAG_RPMVERSION,
RPM_STRING_TYPE, VERSION, 1);
- headerAddEntry(pkg->header, RPMTAG_BUILDHOST,
+ (void) headerAddEntry(pkg->header, RPMTAG_BUILDHOST,
RPM_STRING_TYPE, buildHost(), 1);
- headerAddEntry(pkg->header, RPMTAG_BUILDTIME,
+ (void) headerAddEntry(pkg->header, RPMTAG_BUILDTIME,
RPM_INT32_TYPE, getBuildTime(), 1);
providePackageNVR(pkg->header);
{ const char * optflags = rpmExpand("%{optflags}", NULL);
- headerAddEntry(pkg->header, RPMTAG_OPTFLAGS, RPM_STRING_TYPE,
+ (void) headerAddEntry(pkg->header, RPMTAG_OPTFLAGS, RPM_STRING_TYPE,
optflags, 1);
optflags = _free(optflags);
}
- genSourceRpmName(spec);
- headerAddEntry(pkg->header, RPMTAG_SOURCERPM, RPM_STRING_TYPE,
+ (void) genSourceRpmName(spec);
+ (void) headerAddEntry(pkg->header, RPMTAG_SOURCERPM, RPM_STRING_TYPE,
spec->sourceRpmName, 1);
{ const char *binFormat = rpmGetPath("%{_rpmfilename}", NULL);
@@ -634,7 +639,7 @@ int packageBinaries(Spec spec)
binFormat = _free(binFormat);
if (binRpm == NULL) {
const char *name;
- headerNVR(pkg->header, &name, NULL, NULL);
+ (void) headerNVR(pkg->header, &name, NULL, NULL);
rpmError(RPMERR_BADFILENAME, _("Could not generate output "
"filename for package %s: %s\n"), name, errorString);
return RPMERR_BADFILENAME;
@@ -684,14 +689,14 @@ int packageSources(Spec spec)
int rc;
/* Add some cruft */
- headerAddEntry(spec->sourceHeader, RPMTAG_RPMVERSION,
+ (void) headerAddEntry(spec->sourceHeader, RPMTAG_RPMVERSION,
RPM_STRING_TYPE, VERSION, 1);
- headerAddEntry(spec->sourceHeader, RPMTAG_BUILDHOST,
+ (void) headerAddEntry(spec->sourceHeader, RPMTAG_BUILDHOST,
RPM_STRING_TYPE, buildHost(), 1);
- headerAddEntry(spec->sourceHeader, RPMTAG_BUILDTIME,
+ (void) headerAddEntry(spec->sourceHeader, RPMTAG_BUILDTIME,
RPM_INT32_TYPE, getBuildTime(), 1);
- genSourceRpmName(spec);
+ (void) genSourceRpmName(spec);
spec->cookie = _free(spec->cookie);
diff --git a/build/parseChangelog.c b/build/parseChangelog.c
index 19cb19e2c..00fe5d738 100644
--- a/build/parseChangelog.c
+++ b/build/parseChangelog.c
@@ -12,18 +12,18 @@ void addChangelogEntry(Header h, time_t time, const char *name, const char *text
{
int_32 mytime = time; /* XXX convert to header representation */
if (headerIsEntry(h, RPMTAG_CHANGELOGTIME)) {
- headerAppendEntry(h, RPMTAG_CHANGELOGTIME, RPM_INT32_TYPE,
+ (void) headerAppendEntry(h, RPMTAG_CHANGELOGTIME, RPM_INT32_TYPE,
&mytime, 1);
- headerAppendEntry(h, RPMTAG_CHANGELOGNAME, RPM_STRING_ARRAY_TYPE,
+ (void) headerAppendEntry(h, RPMTAG_CHANGELOGNAME, RPM_STRING_ARRAY_TYPE,
&name, 1);
- headerAppendEntry(h, RPMTAG_CHANGELOGTEXT, RPM_STRING_ARRAY_TYPE,
+ (void) headerAppendEntry(h, RPMTAG_CHANGELOGTEXT, RPM_STRING_ARRAY_TYPE,
&text, 1);
} else {
- headerAddEntry(h, RPMTAG_CHANGELOGTIME, RPM_INT32_TYPE,
+ (void) headerAddEntry(h, RPMTAG_CHANGELOGTIME, RPM_INT32_TYPE,
&mytime, 1);
- headerAddEntry(h, RPMTAG_CHANGELOGNAME, RPM_STRING_ARRAY_TYPE,
+ (void) headerAddEntry(h, RPMTAG_CHANGELOGNAME, RPM_STRING_ARRAY_TYPE,
&name, 1);
- headerAddEntry(h, RPMTAG_CHANGELOGTEXT, RPM_STRING_ARRAY_TYPE,
+ (void) headerAddEntry(h, RPMTAG_CHANGELOGTEXT, RPM_STRING_ARRAY_TYPE,
&text, 1);
}
}
@@ -52,7 +52,7 @@ static int dateToTimet(const char * datestr, /*@out@*/ time_t * secs)
/* day of week */
p = pe; SKIPSPACE(p);
if (*p == '\0') return -1;
- pe = p; SKIPNONSPACE(pe); if (*pe) *pe++ = '\0';
+ pe = p; SKIPNONSPACE(pe); if (*pe != '\0') *pe++ = '\0';
for (idx = days; *idx && strcmp(*idx, p); idx++)
;
if (*idx == NULL) return -1;
@@ -60,7 +60,7 @@ static int dateToTimet(const char * datestr, /*@out@*/ time_t * secs)
/* month */
p = pe; SKIPSPACE(p);
if (*p == '\0') return -1;
- pe = p; SKIPNONSPACE(pe); if (*pe) *pe++ = '\0';
+ pe = p; SKIPNONSPACE(pe); if (*pe != '\0') *pe++ = '\0';
for (idx = months; *idx && strcmp(*idx, p); idx++)
;
if (*idx == NULL) return -1;
@@ -69,7 +69,7 @@ static int dateToTimet(const char * datestr, /*@out@*/ time_t * secs)
/* day */
p = pe; SKIPSPACE(p);
if (*p == '\0') return -1;
- pe = p; SKIPNONSPACE(pe); if (*pe) *pe++ = '\0';
+ pe = p; SKIPNONSPACE(pe); if (*pe != '\0') *pe++ = '\0';
/* make this noon so the day is always right (as we make this UTC) */
time.tm_hour = 12;
@@ -81,7 +81,7 @@ static int dateToTimet(const char * datestr, /*@out@*/ time_t * secs)
/* year */
p = pe; SKIPSPACE(p);
if (*p == '\0') return -1;
- pe = p; SKIPNONSPACE(pe); if (*pe) *pe++ = '\0';
+ pe = p; SKIPNONSPACE(pe); if (*pe != '\0') *pe++ = '\0';
time.tm_year = strtol(p, &q, 10);
if (!(q && *q == '\0')) return -1;
if (time.tm_year < 1997 || time.tm_year >= 3000) return -1;
@@ -115,7 +115,7 @@ static int addChangelog(Header h, StringBuf sb)
/* skip space */
SKIPSPACE(s);
- while (*s) {
+ while (*s != '\0') {
if (*s != '*') {
rpmError(RPMERR_BADSPEC,
_("%%changelog entries must start with *\n"));
@@ -129,7 +129,9 @@ static int addChangelog(Header h, StringBuf sb)
rpmError(RPMERR_BADSPEC, _("incomplete %%changelog entry\n"));
return RPMERR_BADSPEC;
}
+ /*@-modobserver@*/
*s = '\0';
+ /*@=modobserver@*/
text = s + 1;
/* 4 fields of date */
@@ -160,7 +162,7 @@ static int addChangelog(Header h, StringBuf sb)
/* name */
name = s;
- while (*s) s++;
+ while (*s != '\0') s++;
while (s > name && xisspace(*s)) {
*s-- = '\0';
}
diff --git a/build/parseDescription.c b/build/parseDescription.c
index f7052e2df..9dad041d7 100644
--- a/build/parseDescription.c
+++ b/build/parseDescription.c
@@ -118,7 +118,7 @@ int parseDescription(Spec spec)
stripTrailingBlanksStringBuf(sb);
if (!(noLang && strcmp(lang, RPMBUILD_DEFAULT_LANG))) {
- headerAddI18NString(pkg->header, RPMTAG_DESCRIPTION,
+ (void) headerAddI18NString(pkg->header, RPMTAG_DESCRIPTION,
getStringBuf(sb), lang);
}
diff --git a/build/parsePreamble.c b/build/parsePreamble.c
index 73b5de67a..c97843be0 100644
--- a/build/parsePreamble.c
+++ b/build/parsePreamble.c
@@ -50,9 +50,9 @@ static void addOrAppendListEntry(Header h, int_32 tag, char *line)
int argc;
const char **argv;
- poptParseArgvString(line, &argc, &argv);
+ (void) poptParseArgvString(line, &argc, &argv);
if (argc)
- headerAddOrAppendEntry(h, tag, RPM_STRING_ARRAY_TYPE, argv, argc);
+ (void) headerAddOrAppendEntry(h, tag, RPM_STRING_ARRAY_TYPE, argv, argc);
argv = _free(argv);
}
@@ -139,7 +139,7 @@ static int parseBits(const char * s, const tokenBits tokbits,
int c = 0;
if (s) {
- while (*s) {
+ while (*s != '\0') {
while ((c = *s) && xisspace(c)) s++;
se = s;
while ((c = *se) && xisalpha(c)) se++;
@@ -158,7 +158,7 @@ static int parseBits(const char * s, const tokenBits tokbits,
s = ++se;
}
}
- if (c == 0 && *bp) *bp = bits;
+ if (c == 0 && bp) *bp = bits;
return (c ? RPMERR_BADSPEC : 0);
}
@@ -168,13 +168,15 @@ static inline char * findLastChar(char * s)
{
char *res = s;
- while (*s) {
+ while (*s != '\0') {
if (! xisspace(*s))
res = s;
s++;
}
+ /*@-temptrans@*/
return res;
+ /*@=temptrans@*/
}
/**
@@ -304,7 +306,7 @@ static void fillOutMainPackage(Header h)
if (!headerIsEntry(h, ot->ot_tag)) {
const char *val = rpmExpand(ot->ot_mac, NULL);
if (val && *val != '%')
- headerAddEntry(h, ot->ot_tag, RPM_STRING_TYPE, (void *)val, 1);
+ (void) headerAddEntry(h, ot->ot_tag, RPM_STRING_TYPE, (void *)val, 1);
val = _free(val);
}
}
@@ -334,7 +336,7 @@ static int readIcon(Header h, const char *file)
size = fdSize(fd);
iconsize = (size >= 0 ? size : (8 * BUFSIZ));
if (iconsize == 0) {
- Fclose(fd);
+ (void) Fclose(fd);
rc = 0;
goto exit;
}
@@ -348,14 +350,14 @@ static int readIcon(Header h, const char *file)
fn, Fstrerror(fd));
rc = RPMERR_BADSPEC;
}
- Fclose(fd);
+ (void) Fclose(fd);
if (rc)
goto exit;
if (! strncmp(icon, "GIF", sizeof("GIF")-1)) {
- headerAddEntry(h, RPMTAG_GIF, RPM_BIN_TYPE, icon, iconsize);
+ (void) headerAddEntry(h, RPMTAG_GIF, RPM_BIN_TYPE, icon, iconsize);
} else if (! strncmp(icon, "/* XPM", sizeof("/* XPM")-1)) {
- headerAddEntry(h, RPMTAG_XPM, RPM_BIN_TYPE, icon, iconsize);
+ (void) headerAddEntry(h, RPMTAG_XPM, RPM_BIN_TYPE, icon, iconsize);
} else {
rpmError(RPMERR_BADSPEC, _("Unknown icon type: %s\n"), file);
rc = RPMERR_BADSPEC;
@@ -395,7 +397,9 @@ stashSt(Spec spec, Header h, int tag, const char *lang)
}
}
}
+ /*@-usereleased -compdef@*/
return t;
+ /*@=usereleased =compdef@*/
}
#define SINGLE_TOKEN_ONLY \
@@ -446,7 +450,7 @@ static int handlePreambleTag(Spec spec, Package pkg, int tag, const char *macro,
/* See if this is multi-token */
end = field;
SKIPNONSPACE(end);
- if (*end)
+ if (*end != '\0')
multiToken = 1;
switch (tag) {
@@ -471,7 +475,7 @@ static int handlePreambleTag(Spec spec, Package pkg, int tag, const char *macro,
}
addMacro(spec->macros, "PACKAGE_RELEASE", NULL, field, RMIL_OLDSPEC-1);
}
- headerAddEntry(pkg->header, tag, RPM_STRING_TYPE, field, 1);
+ (void) headerAddEntry(pkg->header, tag, RPM_STRING_TYPE, field, 1);
break;
case RPMTAG_GROUP:
case RPMTAG_SUMMARY:
@@ -482,9 +486,9 @@ static int handlePreambleTag(Spec spec, Package pkg, int tag, const char *macro,
case RPMTAG_LICENSE:
case RPMTAG_PACKAGER:
if (!*lang)
- headerAddEntry(pkg->header, tag, RPM_STRING_TYPE, field, 1);
+ (void) headerAddEntry(pkg->header, tag, RPM_STRING_TYPE, field, 1);
else if (!(noLang && strcmp(lang, RPMBUILD_DEFAULT_LANG)))
- headerAddI18NString(pkg->header, tag, field, lang);
+ (void) headerAddI18NString(pkg->header, tag, field, lang);
break;
case RPMTAG_BUILDROOT:
SINGLE_TOKEN_ONLY;
@@ -530,7 +534,7 @@ static int handlePreambleTag(Spec spec, Package pkg, int tag, const char *macro,
} break;
case RPMTAG_PREFIXES:
addOrAppendListEntry(pkg->header, tag, field);
- hge(pkg->header, tag, &type, (void **)&array, &num);
+ (void) hge(pkg->header, tag, &type, (void **)&array, &num);
while (num--) {
len = strlen(array[num]);
if (array[num][len - 1] == '/' && len > 1) {
@@ -563,7 +567,7 @@ static int handlePreambleTag(Spec spec, Package pkg, int tag, const char *macro,
spec->lineNum, spec->line);
return RPMERR_BADSPEC;
}
- headerAddEntry(pkg->header, tag, RPM_INT32_TYPE, &num, 1);
+ (void) headerAddEntry(pkg->header, tag, RPM_INT32_TYPE, &num, 1);
break;
case RPMTAG_AUTOREQPROV:
pkg->autoReq = parseYesNo(field);
@@ -768,7 +772,9 @@ static int findPreambleTag(Spec spec, /*@out@*/int *tag, /*@out@*/char **macro,
*tag = p->tag;
if (macro)
+ /*@-onlytrans@*/
*macro = p->token;
+ /*@=onlytrans@*/
return 0;
}
@@ -803,11 +809,11 @@ int parsePreamble(Spec spec, int initialPackage)
/* Construct the package */
if (flag == PART_SUBNAME) {
const char * mainName;
- headerNVR(spec->packages->header, &mainName, NULL, NULL);
+ (void) headerNVR(spec->packages->header, &mainName, NULL, NULL);
sprintf(fullName, "%s-%s", mainName, name);
} else
strcpy(fullName, name);
- headerAddEntry(pkg->header, RPMTAG_NAME, RPM_STRING_TYPE, fullName, 1);
+ (void) headerAddEntry(pkg->header, RPMTAG_NAME, RPM_STRING_TYPE, fullName, 1);
}
if ((rc = readLine(spec, STRIP_TRAILINGSPACE | STRIP_COMMENTS)) > 0) {
@@ -819,7 +825,7 @@ int parsePreamble(Spec spec, int initialPackage)
/* Skip blank lines */
linep = spec->line;
SKIPSPACE(linep);
- if (*linep) {
+ if (*linep != '\0') {
if (findPreambleTag(spec, &tag, &macro, lang)) {
rpmError(RPMERR_BADSPEC, _("line %d: Unknown tag: %s\n"),
spec->lineNum, spec->line);
diff --git a/build/parsePrep.c b/build/parsePrep.c
index cd61a2f0c..36ddf390b 100644
--- a/build/parsePrep.c
+++ b/build/parsePrep.c
@@ -295,8 +295,8 @@ static int doSetupMacro(Spec spec, char *line)
/* We only parse -a and -b here */
if (parseNum(optArg, &num)) {
- rpmError(RPMERR_BADSPEC, _("line %d: Bad arg to %%setup %c: %s\n"),
- spec->lineNum, num, optArg);
+ rpmError(RPMERR_BADSPEC, _("line %d: Bad arg to %%setup: %s\n"),
+ spec->lineNum, optArg);
freeStringBuf(before);
freeStringBuf(after);
poptFreeContext(optCon);
@@ -328,7 +328,7 @@ static int doSetupMacro(Spec spec, char *line)
spec->buildSubdir = xstrdup(dirName);
} else {
const char *name, *version;
- headerNVR(spec->packages->header, &name, &version, NULL);
+ (void) headerNVR(spec->packages->header, &name, &version, NULL);
sprintf(buf, "%s-%s", name, version);
spec->buildSubdir = xstrdup(buf);
}
@@ -548,6 +548,7 @@ int parsePrep(Spec spec)
}
saveLines = splitString(getStringBuf(buf), strlen(getStringBuf(buf)), '\n');
+ /*@-usereleased@*/
for (lines = saveLines; *lines; lines++) {
res = 0;
if (! strncmp(*lines, "%setup", sizeof("%setup")-1)) {
@@ -563,6 +564,7 @@ int parsePrep(Spec spec)
return res;
}
}
+ /*@=usereleased@*/
freeSplitString(saveLines);
freeStringBuf(buf);
diff --git a/build/parseReqs.c b/build/parseReqs.c
index 5e2f1ab1c..d58b95892 100644
--- a/build/parseReqs.c
+++ b/build/parseReqs.c
@@ -87,7 +87,7 @@ int parseRCPOT(Spec spec, Package pkg, const char *field, int tag,
break;
}
- for (r = field; *r; r = re) {
+ for (r = field; *r != '\0'; r = re) {
SKIPWHITE(r);
if (*r == '\0')
break;
@@ -152,7 +152,7 @@ int parseRCPOT(Spec spec, Package pkg, const char *field, int tag,
case RPMTAG_OBSOLETEFLAGS:
/* Add prereq on rpmlib that has versioned dependencies. */
if (!rpmExpandNumeric("%{_noVersionedDependencies}"))
- rpmlibNeedsFeature(h, "VersionedDependencies", "3.0.3-1");
+ (void) rpmlibNeedsFeature(h, "VersionedDependencies", "3.0.3-1");
break;
default:
break;
@@ -181,7 +181,7 @@ int parseRCPOT(Spec spec, Package pkg, const char *field, int tag,
} else
version = NULL;
- addReqProv(spec, h, flags, req, version, index);
+ (void) addReqProv(spec, h, flags, req, version, index);
req = _free(req);
version = _free(version);
diff --git a/build/parseScript.c b/build/parseScript.c
index 6476f997c..4e2717495 100644
--- a/build/parseScript.c
+++ b/build/parseScript.c
@@ -8,6 +8,8 @@
#include "rpmbuild.h"
#include "debug.h"
+/*@access StringBuf@*/ /* XXX compared with NULL */
+
/**
*/
static int addTriggerIndex(Package pkg, const char *file, const char *script, const char *prog)
@@ -29,7 +31,7 @@ static int addTriggerIndex(Package pkg, const char *file, const char *script, co
new = xmalloc(sizeof(*new));
new->fileName = (file) ? xstrdup(file) : NULL;
- new->script = (*script) ? xstrdup(script) : NULL;
+ new->script = (script && *script != '\0') ? xstrdup(script) : NULL;
new->prog = xstrdup(prog);
new->index = index;
new->next = NULL;
@@ -246,7 +248,7 @@ int parseScript(Spec spec, int parsePart)
stripTrailingBlanksStringBuf(sb);
p = getStringBuf(sb);
- addReqProv(spec, pkg->header, (tagflags | RPMSENSE_INTERP), progArgv[0], NULL, 0);
+ (void) addReqProv(spec, pkg->header, (tagflags | RPMSENSE_INTERP), progArgv[0], NULL, 0);
/* Trigger script insertion is always delayed in order to */
/* get the index right. */
@@ -259,14 +261,14 @@ int parseScript(Spec spec, int parsePart)
goto exit;
} else {
if (progArgc == 1)
- headerAddEntry(pkg->header, progtag, RPM_STRING_TYPE,
+ (void) headerAddEntry(pkg->header, progtag, RPM_STRING_TYPE,
*progArgv, progArgc);
else
- headerAddEntry(pkg->header, progtag, RPM_STRING_ARRAY_TYPE,
+ (void) headerAddEntry(pkg->header, progtag, RPM_STRING_ARRAY_TYPE,
progArgv, progArgc);
- if (*p)
- headerAddEntry(pkg->header, tag, RPM_STRING_TYPE, p, 1);
+ if (*p != '\0')
+ (void) headerAddEntry(pkg->header, tag, RPM_STRING_TYPE, p, 1);
if (file) {
switch (parsePart) {
@@ -291,7 +293,7 @@ int parseScript(Spec spec, int parsePart)
rc = nextPart;
exit:
- if (sb)
+ if (sb != NULL)
freeStringBuf(sb);
progArgv = _free(progArgv);
argv = _free(argv);
diff --git a/build/parseSpec.c b/build/parseSpec.c
index d81d23222..40313873f 100644
--- a/build/parseSpec.c
+++ b/build/parseSpec.c
@@ -75,7 +75,7 @@ static int matchTok(const char *token, const char *line)
size_t toklen = strlen(token);
int rc = 0;
- while ( *(b = be) ) {
+ while ( *(b = be) != '\0' ) {
SKIPSPACE(b);
be = b;
SKIPNONSPACE(be);
@@ -152,7 +152,7 @@ static int copyNextLine(Spec spec, OFI_t *ofi, int strip)
}
/* Save 1st char of next line in order to terminate current line. */
- if (*spec->nextline) {
+ if (*spec->nextline != '\0') {
spec->nextpeekc = *spec->nextline;
*spec->nextline = '\0';
}
@@ -202,7 +202,7 @@ retry:
/* remove this file from the stack */
spec->fileStack = ofi->next;
- Fclose(ofi->fd);
+ (void) Fclose(ofi->fd);
ofi->fileName = _free(ofi->fileName);
ofi = _free(ofi);
@@ -345,7 +345,7 @@ void closeSpec(Spec spec)
while (spec->fileStack) {
ofi = spec->fileStack;
spec->fileStack = spec->fileStack->next;
- if (ofi->fd) Fclose(ofi->fd);
+ if (ofi->fd) (void) Fclose(ofi->fd);
ofi->fileName = _free(ofi->fileName);
ofi = _free(ofi);
}
@@ -546,15 +546,15 @@ fprintf(stderr, "*** PS buildRootURL(%s) %p macro set to %s\n", spec->buildRootU
for (pkg = spec->packages; pkg != NULL; pkg = pkg->next) {
if (!headerIsEntry(pkg->header, RPMTAG_DESCRIPTION)) {
const char * name;
- headerNVR(pkg->header, &name, NULL, NULL);
+ (void) headerNVR(pkg->header, &name, NULL, NULL);
rpmError(RPMERR_BADSPEC, _("Package has no %%description: %s\n"),
name);
freeSpec(spec);
return RPMERR_BADSPEC;
}
- headerAddEntry(pkg->header, RPMTAG_OS, RPM_STRING_TYPE, os, 1);
- headerAddEntry(pkg->header, RPMTAG_ARCH, RPM_STRING_TYPE, arch, 1);
+ (void) headerAddEntry(pkg->header, RPMTAG_OS, RPM_STRING_TYPE, os, 1);
+ (void) headerAddEntry(pkg->header, RPMTAG_ARCH, RPM_STRING_TYPE, arch, 1);
}
#ifdef DYING
myos = _free(myos);
diff --git a/build/reqprov.c b/build/reqprov.c
index 6eeb80ec7..efba0b377 100644
--- a/build/reqprov.c
+++ b/build/reqprov.c
@@ -62,17 +62,17 @@ int addReqProv(/*@unused@*/ Spec spec, Header h,
/* Check for duplicate dependencies. */
if (hge(h, nametag, &dnt, (void **) &names, &len)) {
const char ** versions = NULL;
- int dvt;
+ int dvt = RPM_STRING_ARRAY_TYPE;
int *flags = NULL;
int *indexes = NULL;
int duplicate = 0;
if (flagtag) {
- hge(h, versiontag, &dvt, (void **) &versions, NULL);
- hge(h, flagtag, NULL, (void **) &flags, NULL);
+ (void) hge(h, versiontag, &dvt, (void **) &versions, NULL);
+ (void) hge(h, flagtag, NULL, (void **) &flags, NULL);
}
if (indextag)
- hge(h, indextag, NULL, (void **) &indexes, NULL);
+ (void) hge(h, indextag, NULL, (void **) &indexes, NULL);
while (len > 0) {
len--;
@@ -101,15 +101,15 @@ int addReqProv(/*@unused@*/ Spec spec, Header h,
}
/* Add this dependency. */
- headerAddOrAppendEntry(h, nametag, RPM_STRING_ARRAY_TYPE, &depName, 1);
+ (void) headerAddOrAppendEntry(h, nametag, RPM_STRING_ARRAY_TYPE, &depName, 1);
if (flagtag) {
- headerAddOrAppendEntry(h, versiontag,
+ (void) headerAddOrAppendEntry(h, versiontag,
RPM_STRING_ARRAY_TYPE, &depEVR, 1);
- headerAddOrAppendEntry(h, flagtag,
+ (void) headerAddOrAppendEntry(h, flagtag,
RPM_INT32_TYPE, &depFlags, 1);
}
if (indextag)
- headerAddOrAppendEntry(h, indextag, RPM_INT32_TYPE, &index, 1);
+ (void) headerAddOrAppendEntry(h, indextag, RPM_INT32_TYPE, &index, 1);
return 0;
}
diff --git a/build/spec.c b/build/spec.c
index 153ad2e15..12b0c5b37 100644
--- a/build/spec.c
+++ b/build/spec.c
@@ -63,26 +63,30 @@ int lookupPackage(Spec spec, const char *name, int flag, /*@out@*/Package *pkg)
/* Construct package name */
{ char *n;
if (flag == PART_SUBNAME) {
- headerNVR(spec->packages->header, &pname, NULL, NULL);
+ (void) headerNVR(spec->packages->header, &pname, NULL, NULL);
fullName = n = alloca(strlen(pname) + 1 + strlen(name) + 1);
- while (*pname) *n++ = *pname++;
+ while (*pname != '\0') *n++ = *pname++;
*n++ = '-';
} else {
fullName = n = alloca(strlen(name)+1);
}
+ /*@-mayaliasunique@*/
strcpy(n, name);
+ /*@=mayaliasunique@*/
}
/* Locate package with fullName */
for (p = spec->packages; p != NULL; p = p->next) {
- headerNVR(p->header, &pname, NULL, NULL);
+ (void) headerNVR(p->header, &pname, NULL, NULL);
if (pname && (! strcmp(fullName, pname))) {
break;
}
}
if (pkg)
+ /*@-dependenttrans@*/
*pkg = p;
+ /*@=dependenttrans@*/
return ((p == NULL) ? 1 : 0);
}
@@ -168,7 +172,9 @@ void freePackages(Spec spec)
Package p;
while ((p = spec->packages) != NULL) {
+ /*@-dependenttrans@*/
spec->packages = p->next;
+ /*@=dependenttrans@*/
p->next = NULL;
freePackage(p);
}
@@ -204,7 +210,7 @@ int parseNoSource(Spec spec, const char *field, int tag)
}
fe = field;
- for (f = fe; *f; f = fe) {
+ for (f = fe; *f != '\0'; f = fe) {
struct Source *p;
SKIPWHITE(f);
@@ -212,7 +218,7 @@ int parseNoSource(Spec spec, const char *field, int tag)
break;
fe = f;
SKIPNONWHITE(fe);
- if (*fe) fe++;
+ if (*fe != '\0') fe++;
if (parseNum(f, &num)) {
rpmError(RPMERR_BADSPEC, _("line %d: Bad number: %s\n"),
@@ -345,7 +351,9 @@ static inline void freeSl(/*@only@*/struct speclines *sl)
if (sl == NULL)
return;
for (i = 0; i < sl->sl_nlines; i++)
+ /*@-unqualifiedtrans@*/
sl->sl_lines[i] = _free(sl->sl_lines[i]);
+ /*@=unqualifiedtrans@*/
sl->sl_lines = _free(sl->sl_lines);
sl = _free(sl);
}
@@ -466,7 +474,9 @@ void freeSpec(/*@only@*/ Spec spec)
while (spec->readStack) {
rl = spec->readStack;
+ /*@-dependenttrans@*/
spec->readStack = rl->next;
+ /*@=dependenttrans@*/
rl->next = NULL;
rl = _free(rl);
}
@@ -488,10 +498,14 @@ void freeSpec(/*@only@*/ Spec spec)
if (!spec->inBuildArchitectures) {
while (spec->buildArchitectureCount--) {
+ /*@-unqualifiedtrans@*/
freeSpec(
spec->buildArchitectureSpecs[spec->buildArchitectureCount]);
+ /*@=unqualifiedtrans@*/
}
+ /*@-compdef@*/
spec->buildArchitectureSpecs = _free(spec->buildArchitectureSpecs);
+ /*@=compdef@*/
}
spec->buildArchitectures = _free(spec->buildArchitectures);