From 3ae84a6867ec831d2a3bcc0423565104626efd28 Mon Sep 17 00:00:00 2001 From: jbj Date: Thu, 21 Oct 1999 15:04:25 +0000 Subject: [PATCH] lclint annotations. CVS patchset: 3390 CVS date: 1999/10/21 15:04:25 --- build/.lclintrc | 2 +- build/buildio.h | 2 +- build/expression.c | 25 ++++++++++++++----------- build/misc.c | 2 +- build/parsePreamble.c | 3 +-- build/parsePrep.c | 5 +++-- build/rpmbuild.h | 2 +- build/rpmspec.h | 10 +++++----- lib/cpio.h | 4 ++-- lib/install.c | 2 +- lib/stringbuf.h | 2 +- lib/transaction.c | 12 ++++++------ po/rpm.pot | 50 +++++++++++++++++++++++++------------------------- popt/popt.h | 10 +++++----- 14 files changed, 67 insertions(+), 64 deletions(-) diff --git a/build/.lclintrc b/build/.lclintrc index b2325ae..51ee047 100644 --- a/build/.lclintrc +++ b/build/.lclintrc @@ -12,7 +12,7 @@ #-immediatetrans -mustfree #-observertrans --statictrans +#-statictrans # not-yet normal parameters -boolops # w->n diff --git a/build/buildio.h b/build/buildio.h index 62c13a6..c70fce5 100644 --- a/build/buildio.h +++ b/build/buildio.h @@ -9,7 +9,7 @@ typedef struct cpioSourceArchive { CFD_t cpioCfd; unsigned int cpioArchiveSize; FD_t cpioFdIn; - /*@only@*/struct cpioFileMapping *cpioList; + /*@dependent@*/ struct cpioFileMapping *cpioList; int cpioCount; struct rpmlead *lead; /* XXX FIXME: exorcize lead/arch/os */ } CSA_t; diff --git a/build/expression.c b/build/expression.c index 024068b..58514cc 100644 --- a/build/expression.c +++ b/build/expression.c @@ -59,7 +59,7 @@ static Value valueMakeString(const char *s) return v; } -static void valueFree(Value v) +static void valueFree( /*@only@*/ Value v) { if (v) { if (v->type == VALUE_TYPE_STRING) free(v->data.s); @@ -91,13 +91,12 @@ static void valueDump(const char *msg, Value v, FILE *fp) * Parser state. */ -typedef struct _parseState -{ - char *str; /* expression string */ - char *p; /* current position in expression string */ - int nextToken; /* current lookahead token */ - Value tokenValue; /* valid when TOK_INTEGER or TOK_STRING */ - Spec spec; /* spec file that we are parsing inside of */ +typedef struct _parseState { + /*@owned@*/ char *str; /* expression string */ + /*@dependent@*/ char *p; /* current position in expression string */ + int nextToken; /* current lookahead token */ + Value tokenValue; /* valid when TOK_INTEGER or TOK_STRING */ + Spec spec; /* spec file that we are parsing inside of */ } *ParseState; @@ -377,7 +376,7 @@ static Value doPrimary(ParseState state) break; default: return NULL; - break; + /*@notreached@*/ break; } DEBUG(valueDump("doPrimary:", v, stdout)); @@ -628,8 +627,10 @@ int parseExpressionBoolean(Spec spec, char *expr) DEBUG(printf("parseExprBoolean(?, '%s')\n", expr)); /* Initialize the expression parser state. */ - state.str = state.p = xstrdup(expr); + state.p = state.str = xstrdup(expr); state.spec = spec; + state.nextToken = 0; + state.tokenValue = NULL; rdToken(&state); /* Parse the expression. */ @@ -673,8 +674,10 @@ char * parseExpressionString(Spec spec, char *expr) DEBUG(printf("parseExprString(?, '%s')\n", expr)); /* Initialize the expression parser state. */ - state.str = state.p = xstrdup(expr); + state.p = state.str = xstrdup(expr); state.spec = spec; + state.nextToken = 0; + state.tokenValue = NULL; rdToken(&state); /* Parse the expression. */ diff --git a/build/misc.c b/build/misc.c index 26cdebc..7aa9c46 100644 --- a/build/misc.c +++ b/build/misc.c @@ -15,7 +15,7 @@ int parseNum(const char *line, int *res) return 0; } -char *cleanFileName(const char *name) +const char *cleanFileName(const char *name) { static char res[BUFSIZ]; char *copyTo, copied; diff --git a/build/parsePreamble.c b/build/parsePreamble.c index 43451aa..8a0d9be 100644 --- a/build/parsePreamble.c +++ b/build/parsePreamble.c @@ -631,9 +631,8 @@ static int findPreambleTag(Spec spec, /*@out@*/int *tag, /*@out@*/char **macro, } *tag = p->tag; - if (macro) { + if (macro) *macro = p->token; - } return 0; } diff --git a/build/parsePrep.c b/build/parsePrep.c index 13c79bd..7911158 100644 --- a/build/parsePrep.c +++ b/build/parsePrep.c @@ -33,7 +33,7 @@ static int checkOwners(const char *file) return 0; } -static char *doPatch(Spec spec, int c, int strip, char *db, +/*@observer@*/ static char *doPatch(Spec spec, int c, int strip, const char *db, int reverse, int removeEmpties) { const char *fn = NULL; @@ -100,7 +100,7 @@ static char *doPatch(Spec spec, int c, int strip, char *db, return buf; } -static char *doUntar(Spec spec, int c, int quietly) +/*@observer@*/ static const char *doUntar(Spec spec, int c, int quietly) { const char *fn; static char buf[BUFSIZ]; @@ -322,6 +322,7 @@ static int doPatchMacro(Spec spec, char *line) int patch_nums[1024]; /* XXX - we can only handle 1024 patches! */ int patch_index, x; + memset(patch_nums, 0, sizeof(patch_nums)); opt_P = opt_p = opt_R = opt_E = 0; opt_b = NULL; patch_index = 0; diff --git a/build/rpmbuild.h b/build/rpmbuild.h index 81be09e..9284fa9 100644 --- a/build/rpmbuild.h +++ b/build/rpmbuild.h @@ -94,7 +94,7 @@ int isPart(char *line); /* from build/misc.h */ int parseNum(const char *line, /*@out@*/int *res); -char *cleanFileName(const char *name); +/*@observer@*/ const char *cleanFileName(const char *name); /* from build/parse.h */ diff --git a/build/rpmspec.h b/build/rpmspec.h index 007706c..3b951be 100644 --- a/build/rpmspec.h +++ b/build/rpmspec.h @@ -82,11 +82,11 @@ struct SpecStruct { /*@owned@*/ struct OpenFileInfo *fileStack; char lbuf[BUFSIZ]; char nextpeekc; - char *nextline; - char *line; + /*@dependent@*/ char *nextline; + /*@dependent@*/ char *line; int lineNum; - /*@only@*/ struct ReadLevelEntry *readStack; + /*@owned@*/ struct ReadLevelEntry *readStack; /*@refcounted@*/ Header buildRestrictions; /*@owned@*/ struct SpecStruct **buildArchitectureSpecs; @@ -127,7 +127,7 @@ struct PackageStruct { /*@refcounted@*/ Header header; int cpioCount; - /*@only@*/ struct cpioFileMapping *cpioList; + /*@owned@*/ struct cpioFileMapping *cpioList; /*@owned@*/ struct Source *icon; @@ -152,7 +152,7 @@ struct PackageStruct { /*@only@*/ char *fileFile; /*@only@*/ StringBuf fileList; /* If NULL, package will not be written */ - /*@keep@*/ struct PackageStruct *next; + /*@dependent@*/ struct PackageStruct *next; }; typedef struct PackageStruct *Package; diff --git a/lib/cpio.h b/lib/cpio.h index 057556e..0169ece 100644 --- a/lib/cpio.h +++ b/lib/cpio.h @@ -45,8 +45,8 @@ #define CPIO_FOLLOW_SYMLINKS (1 << 4) /* only for building */ struct cpioFileMapping { - /*@dependent@*/ const char * archivePath; - /*@dependent@*/ const char * fsPath; + /*@owned@*/ const char * archivePath; + /*@owned@*/ const char * fsPath; mode_t finalMode; uid_t finalUid; gid_t finalGid; diff --git a/lib/install.c b/lib/install.c index 43d7cb5..592b416 100644 --- a/lib/install.c +++ b/lib/install.c @@ -587,7 +587,7 @@ int rpmVersionCompare(Header first, Header second) return rpmvercmp(one, two); } -const char * fileActionString(enum fileActions a) +const char *const fileActionString(enum fileActions a) { switch (a) { case FA_UNKNOWN: return "unknown"; diff --git a/lib/stringbuf.h b/lib/stringbuf.h index f339fac..9b658ba 100644 --- a/lib/stringbuf.h +++ b/lib/stringbuf.h @@ -8,7 +8,7 @@ extern "C" { #endif /*@only@*/ StringBuf newStringBuf(void); -void freeStringBuf(/*@only@*/ StringBuf sb); +void freeStringBuf( /*@only@*/ StringBuf sb); void truncStringBuf(StringBuf sb); /*@observer@*/ char *getStringBuf(StringBuf sb); void stripTrailingBlanksStringBuf(StringBuf sb); diff --git a/lib/transaction.c b/lib/transaction.c index b9c80be..e81a5a3 100644 --- a/lib/transaction.c +++ b/lib/transaction.c @@ -448,7 +448,7 @@ static Header relocateFileList(struct availablePackage * alp, int k; haveRelocatedFile = 1; - newDirList = malloc(sizeof(*newDirList) * (dirCount + 1)); + newDirList = xmalloc(sizeof(*newDirList) * (dirCount + 1)); for (k = 0; k < dirCount; k++) { newDirList[k] = alloca(strlen(dirNames[k]) + 1); strcpy(newDirList[k], dirNames[k]); @@ -456,7 +456,7 @@ static Header relocateFileList(struct availablePackage * alp, free(dirNames); dirNames = newDirList; } else { - dirNames = realloc(dirNames, + dirNames = xrealloc(dirNames, sizeof(*dirNames) * (dirCount + 1)); } @@ -1154,7 +1154,7 @@ static void skipFiles(TFI_t * fi, int noDocs) if (languages) freeSplitString((char **)languages); } -#define NOTIFY(_x) if (notify) notify _x +#define NOTIFY(_x) if (notify) (void) notify _x /* Return -1 on error, > 0 if newProbs is set, 0 if everything happened */ @@ -1411,7 +1411,7 @@ int rpmRunTransactions(rpmTransactionSet ts, rpmCallbackFunction notify, } chdir("/"); - chroot(ts->root); + /*@-unrecog@*/ chroot(ts->root); /*@=unrecog@*/ ht = htCreate(totalFileCount * 2, 0, fpHashFunction, fpEqual); fpc = fpCacheCreate(totalFileCount); @@ -1608,7 +1608,7 @@ int rpmRunTransactions(rpmTransactionSet ts, rpmCallbackFunction notify, headerFree(hdrs[i]); rc = rpmReadPackageHeader(fd, &h, NULL, NULL, NULL); if (rc) { - notify(fi->h, RPMCALLBACK_INST_CLOSE_FILE, 0, 0, + (void)notify(fi->h, RPMCALLBACK_INST_CLOSE_FILE, 0, 0, alp->key, notifyData); ourrc++; fd = NULL; @@ -1636,7 +1636,7 @@ int rpmRunTransactions(rpmTransactionSet ts, rpmCallbackFunction notify, headerFree(hdrs[i]); if (alp->fd == NULL && fd) - notify(fi->h, RPMCALLBACK_INST_CLOSE_FILE, 0, 0, alp->key, + (void)notify(fi->h, RPMCALLBACK_INST_CLOSE_FILE, 0, 0, alp->key, notifyData); break; case TR_REMOVED: diff --git a/po/rpm.pot b/po/rpm.pot index be5df6b..194f871 100644 --- a/po/rpm.pot +++ b/po/rpm.pot @@ -6,7 +6,7 @@ msgid "" msgstr "" "Project-Id-Version: PACKAGE VERSION\n" -"POT-Creation-Date: 1999-10-20 14:24-0400\n" +"POT-Creation-Date: 1999-10-20 17:52-0400\n" "PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n" "Last-Translator: FULL NAME \n" "Language-Team: LANGUAGE \n" @@ -1996,69 +1996,69 @@ msgstr "" msgid "dbrecMatchesDepFlags() failed to read header" msgstr "" -#: lib/depends.c:758 +#: lib/depends.c:760 #, c-format msgid "%s: %s satisfied by added file list.\n" msgstr "" -#: lib/depends.c:797 +#: lib/depends.c:799 #, c-format msgid "%s: %s satisfied by added package.\n" msgstr "" -#: lib/depends.c:814 +#: lib/depends.c:816 #, c-format msgid "%s: %s satisfied by added provide.\n" msgstr "" -#: lib/depends.c:845 +#: lib/depends.c:847 #, c-format msgid "%s: %s satisfied by rpmrc provides.\n" msgstr "" -#: lib/depends.c:873 +#: lib/depends.c:875 #, c-format msgid "%s: %s satisfied by db file lists.\n" msgstr "" -#: lib/depends.c:895 +#: lib/depends.c:897 #, c-format msgid "%s: %s satisfied by db provides.\n" msgstr "" -#: lib/depends.c:917 +#: lib/depends.c:919 #, c-format msgid "%s: %s satisfied by db packages.\n" msgstr "" -#: lib/depends.c:930 +#: lib/depends.c:932 #, c-format msgid "%s: %s satisfied by rpmlib version.\n" msgstr "" -#: lib/depends.c:940 +#: lib/depends.c:942 #, c-format msgid "%s: %s unsatisfied.\n" msgstr "" #. requirements are not satisfied. -#: lib/depends.c:988 +#: lib/depends.c:990 #, c-format msgid "package %s require not satisfied: %s\n" msgstr "" #. conflicts exist. -#: lib/depends.c:1050 +#: lib/depends.c:1052 #, c-format msgid "package %s conflicts: %s\n" msgstr "" -#: lib/depends.c:1105 lib/depends.c:1413 +#: lib/depends.c:1107 lib/depends.c:1415 #, c-format msgid "cannot read header at %d for dependency check" msgstr "" -#: lib/depends.c:1200 +#: lib/depends.c:1202 #, c-format msgid "loop in prerequisite chain: %s" msgstr "" @@ -2073,7 +2073,7 @@ msgid "" "if \"rpm --rebuilddb\" fails to correct the problem.\n" msgstr "" -#: lib/formats.c:67 lib/formats.c:85 lib/formats.c:106 lib/formats.c:139 +#: lib/formats.c:69 lib/formats.c:87 lib/formats.c:108 lib/formats.c:141 #: lib/header.c:2122 lib/header.c:2139 lib/header.c:2159 msgid "(not a number)" msgstr "" @@ -3123,37 +3123,37 @@ msgstr "" msgid "missing ':' at %s:%d" msgstr "" -#: lib/rpmrc.c:655 lib/rpmrc.c:729 +#: lib/rpmrc.c:655 lib/rpmrc.c:730 #, c-format msgid "missing argument for %s at %s:%d" msgstr "" -#: lib/rpmrc.c:672 lib/rpmrc.c:694 +#: lib/rpmrc.c:672 lib/rpmrc.c:695 #, c-format msgid "%s expansion failed at %s:%d \"%s\"" msgstr "" -#: lib/rpmrc.c:680 +#: lib/rpmrc.c:681 #, c-format msgid "cannot open %s at %s:%d" msgstr "" -#: lib/rpmrc.c:721 +#: lib/rpmrc.c:722 #, c-format msgid "missing architecture for %s at %s:%d" msgstr "" -#: lib/rpmrc.c:788 +#: lib/rpmrc.c:789 #, c-format msgid "bad option '%s' at %s:%d" msgstr "" -#: lib/rpmrc.c:1147 +#: lib/rpmrc.c:1149 #, c-format msgid "Unknown system: %s\n" msgstr "" -#: lib/rpmrc.c:1148 +#: lib/rpmrc.c:1150 msgid "Please contact rpm-list@redhat.com\n" msgstr "" @@ -3299,7 +3299,7 @@ msgstr "" msgid "excluding file %s%s\n" msgstr "" -#: lib/transaction.c:412 lib/transaction.c:496 +#: lib/transaction.c:412 lib/transaction.c:495 #, c-format msgid "excluding directory %s\n" msgstr "" @@ -3309,12 +3309,12 @@ msgstr "" msgid "relocating %s to %s\n" msgstr "" -#: lib/transaction.c:489 +#: lib/transaction.c:488 #, c-format msgid "relocating directory %s to %s\n" msgstr "" -#: lib/transaction.c:637 +#: lib/transaction.c:636 #, c-format msgid "%s skipped due to missingok flag\n" msgstr "" diff --git a/popt/popt.h b/popt/popt.h index bf463b5..2d9ea8c 100644 --- a/popt/popt.h +++ b/popt/popt.h @@ -52,17 +52,17 @@ extern "C" { #define POPT_CONTEXT_POSIXMEHARDER (1 << 2) /* options can't follow args */ struct poptOption { - const char * longName; /* may be NULL */ + /*@observer@*/ /*@null@*/ const char * longName; /* may be NULL */ char shortName; /* may be '\0' */ int argInfo; - void * arg; /* depends on argInfo */ + /*@dependent@*/ /*@null@*/ void * arg; /* depends on argInfo */ int val; /* 0 means don't return, just update flag */ - const char * descrip; /* description for autohelp -- may be NULL */ - const char * argDescrip; /* argument description for autohelp */ + /*@null@*/ const char * descrip; /* description for autohelp -- may be NULL */ + /*@null@*/ const char * argDescrip; /* argument description for autohelp */ }; struct poptAlias { - const char * longName; /* may be NULL */ + /*@null@*/ const char * longName; /* may be NULL */ char shortName; /* may be '\0' */ int argc; const char ** argv; /* must be free()able */ -- 2.7.4