summaryrefslogtreecommitdiff
path: root/build
diff options
context:
space:
mode:
authorjbj <devnull@localhost>2001-05-05 19:28:32 +0000
committerjbj <devnull@localhost>2001-05-05 19:28:32 +0000
commit8f75bbc17dab6c334583f33c7b912fb16d2ddc4b (patch)
tree145862352d95e2d391f0d65db0027d44bf236b39 /build
parentd78e027808deb6aef4e65338d160986d7e576a90 (diff)
downloadrpm-8f75bbc17dab6c334583f33c7b912fb16d2ddc4b.tar.gz
rpm-8f75bbc17dab6c334583f33c7b912fb16d2ddc4b.tar.bz2
rpm-8f75bbc17dab6c334583f33c7b912fb16d2ddc4b.zip
- enough lclint annotations and fiddles already.
CVS patchset: 4741 CVS date: 2001/05/05 19:28:32
Diffstat (limited to 'build')
-rw-r--r--build/files.c19
-rw-r--r--build/myftw.c2
-rw-r--r--build/pack.c9
-rw-r--r--build/parseChangelog.c8
-rw-r--r--build/parseDescription.c12
-rw-r--r--build/parseFiles.c6
-rw-r--r--build/parsePrep.c30
-rw-r--r--build/parseScript.c7
-rw-r--r--build/rpmbuild.h3
-rw-r--r--build/rpmspec.h2
-rw-r--r--build/spec.c12
11 files changed, 59 insertions, 51 deletions
diff --git a/build/files.c b/build/files.c
index 8e510512e..6f011df9d 100644
--- a/build/files.c
+++ b/build/files.c
@@ -22,9 +22,9 @@
#include "debug.h"
/*@access Header @*/
-/*@access StringBuf @*/
/*@access TFI_t @*/
/*@access FD_t @*/
+/*@access StringBuf @*/ /* compared with NULL */
#define SKIPWHITE(_x) {while(*(_x) && (xisspace(*_x) || *(_x) == ',')) (_x)++;}
#define SKIPNONWHITE(_x){while(*(_x) &&!(xisspace(*_x) || *(_x) == ',')) (_x)++;}
@@ -271,6 +271,7 @@ typedef struct VFA {
/**
*/
+/*@-exportlocal@*/
VFA_t verifyAttrs[] = {
{ "md5", RPMVERIFY_MD5 },
{ "size", RPMVERIFY_FILESIZE },
@@ -282,6 +283,7 @@ VFA_t verifyAttrs[] = {
{ "rdev", RPMVERIFY_RDEV },
{ NULL, 0 }
};
+/*@=exportlocal@*/
/**
* @param fl package file tree walk data
@@ -737,6 +739,7 @@ static int parseForRegexMultiLib(const char *fileName) /*@*/
/**
*/
+/*@-exportlocal@*/
VFA_t virtualFileAttributes[] = {
{ "%dir", 0 }, /* XXX why not RPMFILE_DIR? */
{ "%doc", RPMFILE_DOC },
@@ -756,6 +759,7 @@ VFA_t virtualFileAttributes[] = {
{ NULL, 0 }
};
+/*@=exportlocal@*/
/**
* @param fl package file tree walk data
@@ -1253,7 +1257,9 @@ static void genCpioListAndHeader(/*@partial@*/ FileList fl,
d += 2; /* skip both dirname and basename NUL's */
/* Create archive path, normally adding "./" */
+ /*@-dependenttrans@*/ /* FIX: xstrdup? nah ... */
fi->apath[i] = a;
+ /*@=dependenttrans@*/
if (_addDotSlash) a = stpcpy(a, "./");
a = stpcpy(a, (flp->fileURL + skipLen));
a++; /* skip apath NUL */
@@ -1539,7 +1545,8 @@ exit:
*/
static int processPackageFiles(Spec spec, Package pkg,
int installSpecialDoc, int test)
- /*@modifies pkg->cpioList, pkg->specialDoc, pkg->header */
+ /*@modifies spec->macros,
+ pkg->cpioList, pkg->specialDoc, pkg->header */
{
HGE_t hge = (HGE_t)headerGetEntryMinMemory;
struct FileList_s fl;
@@ -1964,7 +1971,7 @@ int processSourceFiles(Spec spec)
spec->sourceHeader, 1);
}
- freeStringBuf(sourceFiles);
+ sourceFiles = freeStringBuf(sourceFiles);
fl.fileList = freeFileList(fl.fileList, fl.fileListRecsUsed);
return fl.processingFailed;
}
@@ -2118,6 +2125,7 @@ typedef struct {
/**
*/
+/*@-exportlocal@*/
DepMsg_t depMsgs[] = {
{ "Provides", { "%{__find_provides}", NULL, NULL, NULL },
RPMTAG_PROVIDENAME, RPMTAG_PROVIDEVERSION, RPMTAG_PROVIDEFLAGS,
@@ -2157,6 +2165,7 @@ DepMsg_t depMsgs[] = {
0, -1 },
{ NULL, { NULL, NULL, NULL, NULL }, 0, 0, 0, 0, 0 }
};
+/*@=exportlocal@*/
/**
*/
@@ -2261,7 +2270,7 @@ static int generateDepends(Spec spec, Package pkg, TFI_t cpioList, int multiLib)
else
tagflags &= ~RPMSENSE_MULTILIB;
rc = parseRCPOT(spec, pkg, getStringBuf(readBuf), tag, 0, tagflags);
- freeStringBuf(readBuf);
+ readBuf = freeStringBuf(readBuf);
if (rc) {
rpmError(rc, _("Failed to find %s:\n"), dm->msg);
@@ -2269,7 +2278,7 @@ static int generateDepends(Spec spec, Package pkg, TFI_t cpioList, int multiLib)
}
}
- freeStringBuf(writeBuf);
+ writeBuf = freeStringBuf(writeBuf);
return rc;
}
diff --git a/build/myftw.c b/build/myftw.c
index 55ff1e822..499e26ba1 100644
--- a/build/myftw.c
+++ b/build/myftw.c
@@ -30,6 +30,7 @@ Cambridge, MA 02139, USA. */
#define NAMLEN(a) strlen((a)->d_name)
#endif
+#if !defined(__LCLINT__)
#ifndef PATH_MAX
#ifdef _POSIX_VERSION
#define PATH_MAX _POSIX_PATH_MAX
@@ -41,6 +42,7 @@ Cambridge, MA 02139, USA. */
#endif
#endif
#endif
+#endif /* !__LCLINT */
#include "myftw.h"
#include "debug.h"
diff --git a/build/pack.c b/build/pack.c
index e739afd31..f4a2ed031 100644
--- a/build/pack.c
+++ b/build/pack.c
@@ -124,7 +124,7 @@ static /*@only@*/ /*@null@*/ StringBuf addFileToTagAux(Spec spec,
fd = Fopen(fn, "r.ufdio");
if (fn != buf) fn = _free(fn);
if (fd == NULL || Ferror(fd)) {
- freeStringBuf(sb);
+ sb = freeStringBuf(sb);
return NULL;
}
if ((f = fdGetFp(fd)) != NULL)
@@ -132,8 +132,7 @@ static /*@only@*/ /*@null@*/ StringBuf addFileToTagAux(Spec spec,
/* XXX display fn in error msg */
if (expandMacros(spec, spec->macros, buf, sizeof(buf))) {
rpmError(RPMERR_BADSPEC, _("line: %s\n"), buf);
- freeStringBuf(sb);
- sb = NULL;
+ sb = freeStringBuf(sb);
break;
}
appendStringBuf(sb, buf);
@@ -162,7 +161,7 @@ static int addFileToTag(Spec spec, const char * file, Header h, int tag)
(void) headerAddEntry(h, tag, RPM_STRING_TYPE, getStringBuf(sb), 1);
- freeStringBuf(sb);
+ sb = freeStringBuf(sb);
return 0;
}
@@ -180,7 +179,7 @@ static int addFileToArrayTag(Spec spec, const char *file, Header h, int tag)
s = getStringBuf(sb);
(void) headerAddOrAppendEntry(h, tag, RPM_STRING_ARRAY_TYPE, &s, 1);
- freeStringBuf(sb);
+ sb = freeStringBuf(sb);
return 0;
}
diff --git a/build/parseChangelog.c b/build/parseChangelog.c
index 8b9c5fa02..44515383e 100644
--- a/build/parseChangelog.c
+++ b/build/parseChangelog.c
@@ -203,13 +203,11 @@ static int addChangelog(Header h, StringBuf sb)
int parseChangelog(Spec spec)
{
int nextPart, res, rc;
- StringBuf sb;
-
- sb = newStringBuf();
+ StringBuf sb = newStringBuf();
/* There are no options to %changelog */
if ((rc = readLine(spec, STRIP_COMMENTS)) > 0) {
- freeStringBuf(sb);
+ sb = freeStringBuf(sb);
return PART_NONE;
}
if (rc)
@@ -226,7 +224,7 @@ int parseChangelog(Spec spec)
}
res = addChangelog(spec->packages->header, sb);
- freeStringBuf(sb);
+ sb = freeStringBuf(sb);
return (res) ? res : nextPart;
}
diff --git a/build/parseDescription.c b/build/parseDescription.c
index 9dad041d7..3f3ab548b 100644
--- a/build/parseDescription.c
+++ b/build/parseDescription.c
@@ -54,7 +54,7 @@ int parseDescription(Spec spec)
poptBadOption(optCon, POPT_BADOPTION_NOALIAS),
spec->line);
argv = _free(argv);
- poptFreeContext(optCon);
+ optCon = poptFreeContext(optCon);
return RPMERR_BADSPEC;
}
@@ -66,7 +66,7 @@ int parseDescription(Spec spec)
spec->lineNum,
spec->line);
argv = _free(argv);
- poptFreeContext(optCon);
+ optCon = poptFreeContext(optCon);
return RPMERR_BADSPEC;
}
}
@@ -75,7 +75,7 @@ int parseDescription(Spec spec)
rpmError(RPMERR_BADSPEC, _("line %d: Package does not exist: %s\n"),
spec->lineNum, spec->line);
argv = _free(argv);
- poptFreeContext(optCon);
+ optCon = poptFreeContext(optCon);
return RPMERR_BADSPEC;
}
@@ -87,7 +87,7 @@ int parseDescription(Spec spec)
rpmError(RPMERR_BADSPEC, _("line %d: Second description\n"),
spec->lineNum);
argv = _free(argv);
- poptFreeContext(optCon);
+ optCon = poptFreeContext(optCon);
return RPMERR_BADSPEC;
}
#endif
@@ -122,10 +122,10 @@ int parseDescription(Spec spec)
getStringBuf(sb), lang);
}
- freeStringBuf(sb);
+ sb = freeStringBuf(sb);
argv = _free(argv);
- poptFreeContext(optCon);
+ optCon = poptFreeContext(optCon);
return nextPart;
}
diff --git a/build/parseFiles.c b/build/parseFiles.c
index df3e8d9ec..10e6cb056 100644
--- a/build/parseFiles.c
+++ b/build/parseFiles.c
@@ -9,6 +9,7 @@
#include "debug.h"
/*@access StringBuf @*/ /* compared with NULL */
+/*@access poptContext @*/ /* compared with NULL */
/* These have to be global scope to make up for *stupid* compilers */
/*@observer@*/ /*@null@*/ static const char *name = NULL;
@@ -25,7 +26,7 @@ int parseFiles(Spec spec)
Package pkg;
int rc, argc;
int arg;
- const char **argv = NULL;
+ const char ** argv = NULL;
int flag = PART_SUBNAME;
poptContext optCon = NULL;
@@ -106,8 +107,7 @@ int parseFiles(Spec spec)
exit:
argv = _free(argv);
- if (optCon)
- poptFreeContext(optCon);
+ optCon = poptFreeContext(optCon);
return rc;
}
diff --git a/build/parsePrep.c b/build/parsePrep.c
index da18267e6..b7730d757 100644
--- a/build/parsePrep.c
+++ b/build/parsePrep.c
@@ -297,9 +297,9 @@ static int doSetupMacro(Spec spec, char *line)
if (parseNum(optArg, &num)) {
rpmError(RPMERR_BADSPEC, _("line %d: Bad arg to %%setup: %s\n"),
spec->lineNum, (optArg ? optArg : "???"));
- freeStringBuf(before);
- freeStringBuf(after);
- poptFreeContext(optCon);
+ before = freeStringBuf(before);
+ after = freeStringBuf(after);
+ optCon = poptFreeContext(optCon);
argv = _free(argv);
return RPMERR_BADSPEC;
}
@@ -317,9 +317,9 @@ static int doSetupMacro(Spec spec, char *line)
spec->lineNum,
poptBadOption(optCon, POPT_BADOPTION_NOALIAS),
poptStrerror(arg));
- freeStringBuf(before);
- freeStringBuf(after);
- poptFreeContext(optCon);
+ before = freeStringBuf(before);
+ after = freeStringBuf(after);
+ optCon = poptFreeContext(optCon);
argv = _free(argv);
return RPMERR_BADSPEC;
}
@@ -334,7 +334,7 @@ static int doSetupMacro(Spec spec, char *line)
}
addMacro(spec->macros, "buildsubdir", NULL, spec->buildSubdir, RMIL_SPEC);
- poptFreeContext(optCon);
+ optCon = poptFreeContext(optCon);
argv = _free(argv);
/* cd to the build dir */
@@ -369,7 +369,7 @@ static int doSetupMacro(Spec spec, char *line)
}
appendStringBuf(spec->prep, getStringBuf(before));
- freeStringBuf(before);
+ before = freeStringBuf(before);
if (!createDir) {
sprintf(buf, "cd %s", spec->buildSubdir);
@@ -384,7 +384,7 @@ static int doSetupMacro(Spec spec, char *line)
}
appendStringBuf(spec->prep, getStringBuf(after));
- freeStringBuf(after);
+ after = freeStringBuf(after);
/* XXX FIXME: owner & group fixes were conditioned on !geteuid() */
/* Fix the owner, group, and permissions of the setup build tree */
@@ -516,7 +516,7 @@ static int doPatchMacro(Spec spec, char *line)
int parsePrep(Spec spec)
{
int nextPart, res, rc;
- StringBuf buf;
+ StringBuf sb;
char **lines, **saveLines;
if (spec->prep != NULL) {
@@ -533,12 +533,12 @@ int parsePrep(Spec spec)
if (rc)
return rc;
- buf = newStringBuf();
+ sb = newStringBuf();
while (! (nextPart = isPart(spec->line))) {
/* Need to expand the macros inline. That way we */
/* can give good line number information on error. */
- appendStringBuf(buf, spec->line);
+ appendStringBuf(sb, spec->line);
if ((rc = readLine(spec, STRIP_NOTHING)) > 0) {
nextPart = PART_NONE;
break;
@@ -547,7 +547,7 @@ int parsePrep(Spec spec)
return rc;
}
- saveLines = splitString(getStringBuf(buf), strlen(getStringBuf(buf)), '\n');
+ saveLines = splitString(getStringBuf(sb), strlen(getStringBuf(sb)), '\n');
/*@-usereleased@*/
for (lines = saveLines; *lines; lines++) {
res = 0;
@@ -560,14 +560,14 @@ int parsePrep(Spec spec)
}
if (res && !spec->force) {
freeSplitString(saveLines);
- freeStringBuf(buf);
+ sb = freeStringBuf(sb);
return res;
}
}
/*@=usereleased@*/
freeSplitString(saveLines);
- freeStringBuf(buf);
+ sb = freeStringBuf(sb);
return nextPart;
}
diff --git a/build/parseScript.c b/build/parseScript.c
index 4e2717495..070e803ab 100644
--- a/build/parseScript.c
+++ b/build/parseScript.c
@@ -9,6 +9,7 @@
#include "debug.h"
/*@access StringBuf@*/ /* XXX compared with NULL */
+/*@access poptContext @*/ /* compared with NULL */
/**
*/
@@ -293,12 +294,10 @@ int parseScript(Spec spec, int parsePart)
rc = nextPart;
exit:
- if (sb != NULL)
- freeStringBuf(sb);
+ sb = freeStringBuf(sb);
progArgv = _free(progArgv);
argv = _free(argv);
- if (optCon)
- poptFreeContext(optCon);
+ optCon = poptFreeContext(optCon);
return rc;
}
diff --git a/build/rpmbuild.h b/build/rpmbuild.h
index 73c7f50a2..7e66e395c 100644
--- a/build/rpmbuild.h
+++ b/build/rpmbuild.h
@@ -371,6 +371,7 @@ int rpmlibNeedsFeature(Header h, const char * feature, const char * featureEVR)
*/
int processBinaryFiles(Spec spec, int installSpecialDoc, int test)
/*@modifies spec->packages->cpioList, spec->packages->specialDoc,
+ spec->macros,
spec->packages->header @*/;
/** \ingroup rpmbuild
@@ -408,7 +409,7 @@ int processSourceFiles(Spec spec)
* @return
*/
int parseSpec(/*@out@*/ Spec * specp, const char * specFile,
- const char * rootdir,
+ /*@null@*/ const char * rootdir,
/*@null@*/ const char * buildRoot,
int inBuildArch,
/*@null@*/ const char * passPhrase,
diff --git a/build/rpmspec.h b/build/rpmspec.h
index 2533e584e..3b660b0a9 100644
--- a/build/rpmspec.h
+++ b/build/rpmspec.h
@@ -207,7 +207,7 @@ struct spectag * stashSt(Spec spec, Header h, int tag, const char * lang)
*/
int addSource(Spec spec, Package pkg, const char * field, int tag)
/*@modifies spec->sources, spec->numSources,
- spec->st,
+ spec->st, spec->macros,
pkg->icon @*/;
/** \ingroup rpmbuild
diff --git a/build/spec.c b/build/spec.c
index 6d5c5d85f..a0f03d1e1 100644
--- a/build/spec.c
+++ b/build/spec.c
@@ -147,7 +147,7 @@ void freePackage(/*@only@*/ Package p)
p->verifyFile = _free(p->verifyFile);
headerFree(p->header);
- freeStringBuf(p->fileList);
+ p->fileList = freeStringBuf(p->fileList);
p->fileFile = _free(p->fileFile);
if (p->cpioList) {
TFI_t fi = p->cpioList;
@@ -156,7 +156,7 @@ void freePackage(/*@only@*/ Package p)
fi = _free(fi);
}
- freeStringBuf(p->specialDoc);
+ p->specialDoc = freeStringBuf(p->specialDoc);
freeSources(p->icon);
@@ -454,10 +454,10 @@ void freeSpec(/*@only@*/ Spec spec)
freeSl(spec->sl); spec->sl = NULL;
freeSt(spec->st); spec->st = NULL;
- freeStringBuf(spec->prep); spec->prep = NULL;
- freeStringBuf(spec->build); spec->build = NULL;
- freeStringBuf(spec->install); spec->install = NULL;
- freeStringBuf(spec->clean); spec->clean = NULL;
+ spec->prep = freeStringBuf(spec->prep);
+ spec->build = freeStringBuf(spec->build);
+ spec->install = freeStringBuf(spec->install);
+ spec->clean = freeStringBuf(spec->clean);
spec->buildRootURL = _free(spec->buildRootURL);
spec->buildSubdir = _free(spec->buildSubdir);