summaryrefslogtreecommitdiff
path: root/lib
diff options
context:
space:
mode:
authorjbj <devnull@localhost>1999-10-21 20:36:16 +0000
committerjbj <devnull@localhost>1999-10-21 20:36:16 +0000
commitbd34f27bb4617a172b1fee3be70b040e041858a1 (patch)
tree23af919ca601a477ebba4a0672a3b7d2770528f9 /lib
parentc8b83b08c57667fe92ad68a76eba9dff8abd031e (diff)
downloadrpm-bd34f27bb4617a172b1fee3be70b040e041858a1.tar.gz
rpm-bd34f27bb4617a172b1fee3be70b040e041858a1.tar.bz2
rpm-bd34f27bb4617a172b1fee3be70b040e041858a1.zip
lclint annotations and compiler cruft.
CVS patchset: 3394 CVS date: 1999/10/21 20:36:16
Diffstat (limited to 'lib')
-rw-r--r--lib/ftp.c2
-rw-r--r--lib/header.c54
-rw-r--r--lib/misc.c4
-rw-r--r--lib/rpmlib.h2
-rw-r--r--lib/rpmurl.h2
-rw-r--r--lib/tagName.c2
-rw-r--r--lib/verify.c2
7 files changed, 42 insertions, 26 deletions
diff --git a/lib/ftp.c b/lib/ftp.c
index 79b865ee0..ff2ede460 100644
--- a/lib/ftp.c
+++ b/lib/ftp.c
@@ -660,7 +660,7 @@ int ftpClose(FD_t fd) {
return 0;
}
-const char *ftpStrerror(int errorNumber) {
+const char *const ftpStrerror(int errorNumber) {
switch (errorNumber) {
case 0:
return _("Success");
diff --git a/lib/header.c b/lib/header.c
index 317281fe3..05e640668 100644
--- a/lib/header.c
+++ b/lib/header.c
@@ -87,26 +87,26 @@ struct sprintfToken {
enum { PTOK_NONE = 0, PTOK_TAG, PTOK_ARRAY, PTOK_STRING, PTOK_COND } type;
union {
struct {
- struct sprintfToken * format;
+ /*@only@*/ struct sprintfToken * format;
int numTokens;
} array;
struct sprintfTag tag;
struct {
- char * string;
+ /*@dependent@*/ char * string;
int len;
} string;
struct {
- struct sprintfToken * ifFormat;
+ /*@only@*/ struct sprintfToken * ifFormat;
int numIfTokens;
- struct sprintfToken * elseFormat;
+ /*@only@*/ struct sprintfToken * elseFormat;
int numElseTokens;
struct sprintfTag tag;
} cond;
} u;
};
-static void copyEntry(struct indexEntry * entry, /*@out@*/int_32 *type,
- /*@out@*/void **p, /*@out@*/int_32 *c, int minimizeMemory)
+static void copyEntry(struct indexEntry * entry, /*@out@*/ int_32 * type,
+ /*@out@*/ void ** p, /*@out@*/ int_32 * c, int minimizeMemory)
{
int i, tableSize;
char ** ptrEntry;
@@ -907,7 +907,8 @@ static int headerMatchLocale(const char *td, const char *l, const char *le)
return 0;
}
-static char *headerFindI18NString(Header h, struct indexEntry *entry)
+/*@dependent@*/ static char *
+headerFindI18NString(Header h, struct indexEntry *entry)
{
const char *lang, *l, *le;
struct indexEntry * table;
@@ -1016,7 +1017,7 @@ void headerFree(Header h)
free(h->index[i].data);
free(h->index);
- free(h);
+ /*@-refcounttrans@*/ free(h); /*@=refcounttrans@*/
}
Header headerLink(Header h)
@@ -1165,7 +1166,6 @@ headerGetLangs(Header h)
int headerAddI18NString(Header h, int_32 tag, char * string, char * lang)
{
struct indexEntry * table, * entry;
- char * charArray[2];
char * chptr;
char ** strArray;
int length;
@@ -1181,16 +1181,17 @@ int headerAddI18NString(Header h, int_32 tag, char * string, char * lang)
}
if (!table && !entry) {
+ char * charArray[2];
+ int count = 0;
if (!lang || (lang[0] == 'C' && lang[1] == '\0')) {
- charArray[0] = "C";
- if (!headerAddEntry(h, HEADER_I18NTABLE, RPM_STRING_ARRAY_TYPE,
- &charArray, 1)) return 0;
+ charArray[count++] = "C";
} else {
- charArray[0] = "C";
- charArray[1] = lang;
- if (!headerAddEntry(h, HEADER_I18NTABLE, RPM_STRING_ARRAY_TYPE,
- &charArray, 2)) return 0;
+ charArray[count++] = "C";
+ charArray[count++] = lang;
}
+ if (!headerAddEntry(h, HEADER_I18NTABLE, RPM_STRING_ARRAY_TYPE,
+ &charArray, count))
+ return 0;
table = findEntry(h, HEADER_I18NTABLE, RPM_STRING_ARRAY_TYPE);
}
@@ -1386,13 +1387,21 @@ static void freeFormat( /*@only@*/ struct sprintfToken * format, int num)
int i;
for (i = 0; i < num; i++) {
- if (format[i].type == PTOK_ARRAY)
+ switch (format[i].type) {
+ case PTOK_ARRAY:
freeFormat(format[i].u.array.format, format[i].u.array.numTokens);
- if (format[i].type == PTOK_COND) {
+ break;
+ case PTOK_COND:
freeFormat(format[i].u.cond.ifFormat,
format[i].u.cond.numIfTokens);
freeFormat(format[i].u.cond.elseFormat,
format[i].u.cond.numElseTokens);
+ break;
+ case PTOK_NONE:
+ case PTOK_TAG:
+ case PTOK_STRING:
+ default:
+ break;
}
}
free(format);
@@ -1669,12 +1678,13 @@ static int parseFormat(char * str, const struct headerTagTableEntry * tags,
static int parseExpression(struct sprintfToken * token, char * str,
const struct headerTagTableEntry * tags,
const struct headerSprintfExtension * extensions,
- /*@out@*/char ** endPtr, /*@out@*/const char ** error)
+ /*@out@*/ char ** endPtr, /*@out@*/ const char ** error)
{
char * chptr, * end;
const struct headerTagTableEntry * tag;
const struct headerSprintfExtension * ext;
+ *error = NULL;
chptr = str;
while (*chptr && *chptr != '?') chptr++;
@@ -1698,6 +1708,7 @@ static int parseExpression(struct sprintfToken * token, char * str,
if (!*end) {
*error = _("} expected in expression");
freeFormat(token->u.cond.ifFormat, token->u.cond.numIfTokens);
+ token->u.cond.ifFormat = NULL;
return 1;
}
@@ -1705,6 +1716,7 @@ static int parseExpression(struct sprintfToken * token, char * str,
if (*chptr != ':' && *chptr != '|') {
*error = _(": expected following ? subexpression");
freeFormat(token->u.cond.ifFormat, token->u.cond.numIfTokens);
+ token->u.cond.ifFormat = NULL;
return 1;
}
@@ -1718,6 +1730,7 @@ static int parseExpression(struct sprintfToken * token, char * str,
if (*chptr != '{') {
*error = _("{ expected after : in expression");
freeFormat(token->u.cond.ifFormat, token->u.cond.numIfTokens);
+ token->u.cond.ifFormat = NULL;
return 1;
}
@@ -1730,6 +1743,7 @@ static int parseExpression(struct sprintfToken * token, char * str,
if (!*end) {
*error = _("} expected in expression");
freeFormat(token->u.cond.ifFormat, token->u.cond.numIfTokens);
+ token->u.cond.ifFormat = NULL;
return 1;
}
@@ -1737,7 +1751,9 @@ static int parseExpression(struct sprintfToken * token, char * str,
if (*chptr != '|') {
*error = _("| expected at end of expression");
freeFormat(token->u.cond.ifFormat, token->u.cond.numIfTokens);
+ token->u.cond.ifFormat = NULL;
freeFormat(token->u.cond.elseFormat, token->u.cond.numElseTokens);
+ token->u.cond.elseFormat = NULL;
return 1;
}
}
diff --git a/lib/misc.c b/lib/misc.c
index 4c8eb75c9..d94ea9c4b 100644
--- a/lib/misc.c
+++ b/lib/misc.c
@@ -464,8 +464,8 @@ void compressFilelist(Header h) {
/* this is pretty straight-forward. The only thing that even resembles a trick
is getting all of this into a single xmalloc'd block */
-static void doBuildFileList(Header h, char *** fileListPtr,
- int * fileCountPtr, int baseNameTag,
+static void doBuildFileList(Header h, /*@out@*/ char *** fileListPtr,
+ /*@out@*/ int * fileCountPtr, int baseNameTag,
int dirListTag, int dirIndexesTag) {
int * dirList;
char ** dirs;
diff --git a/lib/rpmlib.h b/lib/rpmlib.h
index 690c87c15..d1f46e6f4 100644
--- a/lib/rpmlib.h
+++ b/lib/rpmlib.h
@@ -683,7 +683,7 @@ int showMatches(QVA_t *qva, rpmdb db, dbiIndexSet matches, QVF_t showPackage);
#define QUERY_FOR_CONFIG (1 << 4)
#define QUERY_FOR_DUMPFILES (1 << 8)
-const char *tagName(int tag);
+/*@observer@*/ const char *const tagName(int tag);
extern char *specedit;
extern struct poptOption rpmQueryPoptTable[];
diff --git a/lib/rpmurl.h b/lib/rpmurl.h
index 2959eea12..e8b3fa4b9 100644
--- a/lib/rpmurl.h
+++ b/lib/rpmurl.h
@@ -50,7 +50,7 @@ typedef struct urlinfo {
extern "C" {
#endif
-/*@only@*/ /*@observer@*/ const char * ftpStrerror(int ftpErrno);
+/*@observer@*/ const char *const ftpStrerror(int ftpErrno);
void urlSetCallback(rpmCallbackFunction notify, void *notifyData, int notifyCount);
int httpOpen(urlinfo *u);
diff --git a/lib/tagName.c b/lib/tagName.c
index b5f5a7cfd..2682ece2b 100644
--- a/lib/tagName.c
+++ b/lib/tagName.c
@@ -2,7 +2,7 @@
#include <rpmlib.h>
-const char *tagName(int tag)
+const char *const tagName(int tag)
{
int i;
static char nameBuf[128]; /* XXX yuk */
diff --git a/lib/verify.c b/lib/verify.c
index 5a429eabb..4a4e70dbe 100644
--- a/lib/verify.c
+++ b/lib/verify.c
@@ -247,7 +247,7 @@ int rpmVerifyScript(const char * root, Header h, FD_t err)
/* ======================================================================== */
static int verifyHeader(QVA_t *qva, Header h)
{
- const char ** fileList;
+ char ** fileList;
int count;
int verifyResult;
int i, ec, rc;