lclint annotations.
authorjbj <devnull@localhost>
Thu, 21 Oct 1999 15:04:25 +0000 (15:04 +0000)
committerjbj <devnull@localhost>
Thu, 21 Oct 1999 15:04:25 +0000 (15:04 +0000)
CVS patchset: 3390
CVS date: 1999/10/21 15:04:25

14 files changed:
build/.lclintrc
build/buildio.h
build/expression.c
build/misc.c
build/parsePreamble.c
build/parsePrep.c
build/rpmbuild.h
build/rpmspec.h
lib/cpio.h
lib/install.c
lib/stringbuf.h
lib/transaction.c
po/rpm.pot
popt/popt.h

index b2325ae..51ee047 100644 (file)
@@ -12,7 +12,7 @@
 #-immediatetrans
 -mustfree
 #-observertrans
--statictrans
+#-statictrans
 
 # not-yet normal parameters
 -boolops               # w->n
index 62c13a6..c70fce5 100644 (file)
@@ -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;
index 024068b..58514cc 100644 (file)
@@ -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. */
index 26cdebc..7aa9c46 100644 (file)
@@ -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;
index 43451aa..8a0d9be 100644 (file)
@@ -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;
 }
 
index 13c79bd..7911158 100644 (file)
@@ -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;
index 81be09e..9284fa9 100644 (file)
@@ -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 */
 
index 007706c..3b951be 100644 (file)
@@ -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;
index 057556e..0169ece 100644 (file)
@@ -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;
index 43d7cb5..592b416 100644 (file)
@@ -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";
index f339fac..9b658ba 100644 (file)
@@ -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);
index b9c80be..e81a5a3 100644 (file)
@@ -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:
index be5df6b..194f871 100644 (file)
@@ -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 <EMAIL@ADDRESS>\n"
 "Language-Team: LANGUAGE <LL@li.org>\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 ""
index bf463b5..2d9ea8c 100644 (file)
@@ -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 */