diff options
author | jbj <devnull@localhost> | 2001-09-24 21:53:14 +0000 |
---|---|---|
committer | jbj <devnull@localhost> | 2001-09-24 21:53:14 +0000 |
commit | 9d555b6216692deeb97eb821e42716a7cd529ae0 (patch) | |
tree | 047af9e929f71681dbdf00af8d7b3bbe23cbfcc1 /lib | |
parent | 76b20cd2f4ebd499766aec27f62089690ac1d073 (diff) | |
download | librpm-tizen-9d555b6216692deeb97eb821e42716a7cd529ae0.tar.gz librpm-tizen-9d555b6216692deeb97eb821e42716a7cd529ae0.tar.bz2 librpm-tizen-9d555b6216692deeb97eb821e42716a7cd529ae0.zip |
Move to lclint-3.0.0.15, revisit and clean up annotations.
intl/: Add gettext orphans.
popt/intl/: Add gettext orphans.
beecrypt: Add beecrypt repository.
rpmio/tdigest.c: Add beecrypt digest checks.
CVS patchset: 5077
CVS date: 2001/09/24 21:53:14
Diffstat (limited to 'lib')
-rw-r--r-- | lib/depends.c | 25 | ||||
-rw-r--r-- | lib/depends.h | 4 | ||||
-rw-r--r-- | lib/fsm.c | 22 | ||||
-rw-r--r-- | lib/getdate.c | 92 | ||||
-rw-r--r-- | lib/getdate.y | 8 | ||||
-rw-r--r-- | lib/header.c | 4 | ||||
-rw-r--r-- | lib/header.h | 2 | ||||
-rw-r--r-- | lib/header_internal.h | 2 | ||||
-rw-r--r-- | lib/package.c | 10 | ||||
-rw-r--r-- | lib/problems.c | 4 | ||||
-rw-r--r-- | lib/psm.c | 12 | ||||
-rw-r--r-- | lib/rpmchecksig.c | 6 | ||||
-rw-r--r-- | lib/rpmcli.h | 2 | ||||
-rw-r--r-- | lib/rpminstall.c | 2 | ||||
-rw-r--r-- | lib/rpmlead.c | 2 | ||||
-rw-r--r-- | lib/rpmlib.h | 2 | ||||
-rw-r--r-- | lib/rpmrc.c | 10 | ||||
-rw-r--r-- | lib/signature.c | 6 | ||||
-rw-r--r-- | lib/stringbuf.c | 4 | ||||
-rw-r--r-- | lib/transaction.c | 37 |
20 files changed, 127 insertions, 129 deletions
diff --git a/lib/depends.c b/lib/depends.c index 479b0701c..98c7895cf 100644 --- a/lib/depends.c +++ b/lib/depends.c @@ -600,10 +600,6 @@ exit: return result; } -/*@-typeuse@*/ -typedef int (*dbrecMatch_t) (Header h, const char *reqName, const char * reqEVR, int reqFlags); -/*@=typeuse@*/ - static int rangeMatchesDepFlags (Header h, const char * reqName, const char * reqEVR, int reqFlags) /*@*/ @@ -962,12 +958,12 @@ alAllFileSatisfiesDepend(const availableList al, const char * keyType, const char * fileName) /*@*/ { - int i, found; + int i, found = 0; const char * dirName; const char * baseName; struct dirInfo_s dirNeedle; dirInfo dirMatch; - struct availablePackage ** ret; + struct availablePackage ** ret = NULL; /* Solaris 2.6 bsearch sucks down on this. */ if (al->numDirs == 0 || al->dirs == NULL || al->list == NULL) @@ -985,18 +981,16 @@ alAllFileSatisfiesDepend(const availableList al, dirNeedle.dirNameLen = strlen(dirName); dirMatch = bsearch(&dirNeedle, al->dirs, al->numDirs, sizeof(dirNeedle), dirInfoCompare); - if (dirMatch == NULL) { - dirName = _free(dirName); - return NULL; - } + if (dirMatch == NULL) + goto exit; /* rewind to the first match */ while (dirMatch > al->dirs && dirInfoCompare(dirMatch-1, &dirNeedle) == 0) dirMatch--; - /*@-nullptrarith@*/ /* FIX: fileName NULL ??? */ - baseName = strrchr(fileName, '/') + 1; - /*@=nullptrarith@*/ + if ((baseName = strrchr(fileName, '/')) == NULL) + goto exit; + baseName++; for (found = 0, ret = NULL; dirMatch <= al->dirs + al->numDirs && @@ -1028,6 +1022,7 @@ alAllFileSatisfiesDepend(const availableList al, } } +exit: dirName = _free(dirName); /*@-mods@*/ /* FIX: al->list might be modified. */ if (ret) @@ -2100,7 +2095,7 @@ rescan: * the new package. This would be easier if we could sort the * addedPackages array, but we store indexes into it in various places. */ - orderList = xmalloc(npkgs * sizeof(*orderList)); + orderList = xcalloc(npkgs, sizeof(*orderList)); for (i = 0, j = 0; i < ts->orderCount; i++) { if (ts->order[i].type == TR_ADDED) { orderList[j].alIndex = ts->order[i].u.addedIndex; @@ -2112,7 +2107,7 @@ rescan: qsort(orderList, npkgs, sizeof(*orderList), orderListIndexCmp); - newOrder = xmalloc(ts->orderCount * sizeof(*newOrder)); + newOrder = xcalloc(ts->orderCount, sizeof(*newOrder)); for (i = 0, newOrderCount = 0; i < orderingCount; i++) { struct orderListIndex * needle, key; diff --git a/lib/depends.h b/lib/depends.h index ccd917691..9f25da588 100644 --- a/lib/depends.h +++ b/lib/depends.h @@ -11,6 +11,7 @@ /** \ingroup rpmdep * Dependncy ordering information. */ +/*@-fielduse@*/ /* LCL: confused by union? */ struct tsortInfo { union { int count; @@ -23,6 +24,7 @@ struct tsortInfo { int tsi_reqx; int tsi_qcnt; } ; +/*@=fielduse@*/ /** \ingroup rpmdep * Info about a single package to be installed. @@ -107,6 +109,7 @@ typedef /*@abstract@*/ struct availableList_s { /** \ingroup rpmdep * A single package instance to be installed/removed atomically. */ +/*@-fielduse@*/ /* LCL: confused by union? */ struct transactionElement { enum rpmTransactionType { TR_ADDED, /*!< Package will be installed. */ @@ -120,6 +123,7 @@ struct transactionElement { } removed; } u; } ; +/*@=fielduse@*/ /** \ingroup rpmdep * The set of packages to be installed/removed atomically. @@ -63,19 +63,17 @@ const char * fsmFsPath(/*@special@*/ /*@null@*/ const FSM_t fsm, if (fsm) { int nb; char * t; - /*@-nullpass@*/ /* LCL: subdir/suffix != NULL */ nb = strlen(fsm->dirName) + - (st && subdir && !S_ISDIR(st->st_mode) ? strlen(subdir) : 0) + - (st && suffix && !S_ISDIR(st->st_mode) ? strlen(suffix) : 0) + + (st && !S_ISDIR(st->st_mode) ? (subdir ? strlen(subdir) : 0) : 0) + + (st && !S_ISDIR(st->st_mode) ? (suffix ? strlen(suffix) : 0) : 0) + strlen(fsm->baseName) + 1; s = t = xmalloc(nb); t = stpcpy(t, fsm->dirName); - if (st && subdir && !S_ISDIR(st->st_mode)) - t = stpcpy(t, subdir); + if (st && !S_ISDIR(st->st_mode)) + if (subdir) t = stpcpy(t, subdir); t = stpcpy(t, fsm->baseName); - if (st && suffix && !S_ISDIR(st->st_mode)) - t = stpcpy(t, suffix); - /*@=nullpass@*/ + if (st && !S_ISDIR(st->st_mode)) + if (suffix) t = stpcpy(t, suffix); } return s; } @@ -331,7 +329,6 @@ static /*@observer@*/ const char * dnlNextIterator(/*@null@*/ DNLI_t dnli) * @param fsm file state machine data * @return Is chain only partially filled? */ -/*@-compmempass@*/ static int saveHardLink(/*@special@*/ /*@partial@*/ FSM_t fsm) /*@uses fsm->links, fsm->ix, fsm->sb, fsm->goal, fsm->nsuffix @*/ /*@defines fsm->li @*/ @@ -413,7 +410,6 @@ static int saveHardLink(/*@special@*/ /*@partial@*/ FSM_t fsm) return rc; /*@=nullstate@*/ } -/*@=compmempass@*/ /** \ingroup payload * Destroy set of hard links. @@ -1000,7 +996,6 @@ static int fsmCommitLinks(/*@special@*/ FSM_t fsm) * @param fsm file state machine data * @return 0 on success */ -/*@-compdef@*/ static int fsmRmdirs(/*@special@*/ FSM_t fsm) /*@uses fsm->path, fsm->dnlx, fsm->ldn, fsm->rdbuf, fsm->iter @*/ /*@modifies fsm, fileSystem @*/ @@ -1037,7 +1032,7 @@ static int fsmRmdirs(/*@special@*/ FSM_t fsm) if (rc) /*@innerbreak@*/ break; te--; - } while ((te - dn) > fsm->dnlx[dc]); + } while ((te - fsm->path) > fsm->dnlx[dc]); } dnli = dnlFreeIterator(dnli); /*@=observertrans =dependenttrans@*/ @@ -1045,7 +1040,6 @@ static int fsmRmdirs(/*@special@*/ FSM_t fsm) fsm->path = path; return rc; } -/*@=compdef@*/ /** * Create (if necessary) directories not explicitly included in package. @@ -1458,7 +1452,7 @@ int fsmStage(FSM_t fsm, fileStage stage) fsm->postpone = XFA_SKIPPING(fsm->action); if (fsm->goal == FSM_PKGINSTALL || fsm->goal == FSM_PKGBUILD) { - /*@-evalorder@*/ + /*@-evalorder@*/ /* FIX: saveHardLink can modify fsm */ if (!S_ISDIR(st->st_mode) && st->st_nlink > 1) fsm->postpone = saveHardLink(fsm); /*@=evalorder@*/ diff --git a/lib/getdate.c b/lib/getdate.c index 2d40c5cfa..8d56a0277 100644 --- a/lib/getdate.c +++ b/lib/getdate.c @@ -90,9 +90,9 @@ static int yygrowstack(); */ struct timeb { time_t time; /* Seconds since the epoch */ - unsigned short millitm; /* Field not used */ +/*@unused@*/ unsigned short millitm; /* Field not used */ short timezone; /* Minutes west of GMT */ - short dstflag; /* Field not used */ +/*@unused@*/ short dstflag; /* Field not used */ }; #endif /* defined(HAVE_SYS_TIMEB_H) */ @@ -131,7 +131,9 @@ extern struct tm *gmtime(); extern struct tm *localtime(); #endif +/*@-exportheader@*/ extern time_t get_date(char * p, struct timeb * now); +/*@=exportheader@*/ #define yyparse getdate_yyparse #define yylex getdate_yylex @@ -197,12 +199,12 @@ static MERIDIAN yyMeridian; static time_t yyRelMonth; static time_t yyRelSeconds; -#line 184 "./getdate.y" +#line 186 "./getdate.y" typedef union { time_t Number; enum _MERIDIAN Meridian; } YYSTYPE; -#line 203 "getdate.c" +#line 205 "getdate.c" #define YYERRCODE 256 #define tAGO 257 #define tDAY 258 @@ -420,7 +422,7 @@ static short *yyss; static short *yysslim; static YYSTYPE *yyvs; static int yystacksize; -#line 403 "./getdate.y" +#line 405 "./getdate.y" /* Month and day table. */ static TABLE const MonthDayTable[] = { @@ -611,7 +613,7 @@ static TABLE const MilitaryTable[] = { /* ARGSUSED */ static int -yyerror(const char * s) +yyerror(/*@unused@*/ const char * s) { return 0; } @@ -1049,7 +1051,7 @@ main(ac, av) /* NOTREACHED */ } #endif /* defined(TEST) */ -#line 1050 "getdate.c" +#line 1052 "getdate.c" /* allocate initial stack or double stack size, up to YYMAXDEPTH */ static int yygrowstack() { @@ -1245,37 +1247,37 @@ yyreduce: switch (yyn) { case 3: -#line 202 "./getdate.y" +#line 204 "./getdate.y" { yyHaveTime++; } break; case 4: -#line 205 "./getdate.y" +#line 207 "./getdate.y" { yyHaveZone++; } break; case 5: -#line 208 "./getdate.y" +#line 210 "./getdate.y" { yyHaveDate++; } break; case 6: -#line 211 "./getdate.y" +#line 213 "./getdate.y" { yyHaveDay++; } break; case 7: -#line 214 "./getdate.y" +#line 216 "./getdate.y" { yyHaveRel++; } break; case 9: -#line 220 "./getdate.y" +#line 222 "./getdate.y" { yyHour = yyvsp[-1].Number; yyMinutes = 0; @@ -1284,7 +1286,7 @@ case 9: } break; case 10: -#line 226 "./getdate.y" +#line 228 "./getdate.y" { yyHour = yyvsp[-3].Number; yyMinutes = yyvsp[-1].Number; @@ -1293,7 +1295,7 @@ case 10: } break; case 11: -#line 232 "./getdate.y" +#line 234 "./getdate.y" { yyHour = yyvsp[-3].Number; yyMinutes = yyvsp[-1].Number; @@ -1303,7 +1305,7 @@ case 11: } break; case 12: -#line 239 "./getdate.y" +#line 241 "./getdate.y" { yyHour = yyvsp[-5].Number; yyMinutes = yyvsp[-3].Number; @@ -1312,7 +1314,7 @@ case 12: } break; case 13: -#line 245 "./getdate.y" +#line 247 "./getdate.y" { yyHour = yyvsp[-5].Number; yyMinutes = yyvsp[-3].Number; @@ -1323,56 +1325,56 @@ case 13: } break; case 14: -#line 255 "./getdate.y" +#line 257 "./getdate.y" { yyTimezone = yyvsp[0].Number; yyDSTmode = DSToff; } break; case 15: -#line 259 "./getdate.y" +#line 261 "./getdate.y" { yyTimezone = yyvsp[0].Number; yyDSTmode = DSTon; } break; case 16: -#line 264 "./getdate.y" +#line 266 "./getdate.y" { yyTimezone = yyvsp[-1].Number; yyDSTmode = DSTon; } break; case 17: -#line 270 "./getdate.y" +#line 272 "./getdate.y" { yyDayOrdinal = 1; yyDayNumber = yyvsp[0].Number; } break; case 18: -#line 274 "./getdate.y" +#line 276 "./getdate.y" { yyDayOrdinal = 1; yyDayNumber = yyvsp[-1].Number; } break; case 19: -#line 278 "./getdate.y" +#line 280 "./getdate.y" { yyDayOrdinal = yyvsp[-1].Number; yyDayNumber = yyvsp[0].Number; } break; case 20: -#line 284 "./getdate.y" +#line 286 "./getdate.y" { yyMonth = yyvsp[-2].Number; yyDay = yyvsp[0].Number; } break; case 21: -#line 288 "./getdate.y" +#line 290 "./getdate.y" { if (yyvsp[-4].Number >= 100) { yyYear = yyvsp[-4].Number; @@ -1386,7 +1388,7 @@ case 21: } break; case 22: -#line 299 "./getdate.y" +#line 301 "./getdate.y" { /* ISO 8601 format. yyyy-mm-dd. */ yyYear = yyvsp[-2].Number; @@ -1395,7 +1397,7 @@ case 22: } break; case 23: -#line 305 "./getdate.y" +#line 307 "./getdate.y" { /* e.g. 17-JUN-1992. */ yyDay = yyvsp[-2].Number; @@ -1404,14 +1406,14 @@ case 23: } break; case 24: -#line 311 "./getdate.y" +#line 313 "./getdate.y" { yyMonth = yyvsp[-1].Number; yyDay = yyvsp[0].Number; } break; case 25: -#line 315 "./getdate.y" +#line 317 "./getdate.y" { yyMonth = yyvsp[-3].Number; yyDay = yyvsp[-2].Number; @@ -1419,14 +1421,14 @@ case 25: } break; case 26: -#line 320 "./getdate.y" +#line 322 "./getdate.y" { yyMonth = yyvsp[0].Number; yyDay = yyvsp[-1].Number; } break; case 27: -#line 324 "./getdate.y" +#line 326 "./getdate.y" { yyMonth = yyvsp[-1].Number; yyDay = yyvsp[-2].Number; @@ -1434,68 +1436,68 @@ case 27: } break; case 28: -#line 331 "./getdate.y" +#line 333 "./getdate.y" { yyRelSeconds = -yyRelSeconds; yyRelMonth = -yyRelMonth; } break; case 30: -#line 338 "./getdate.y" +#line 340 "./getdate.y" { yyRelSeconds += yyvsp[-1].Number * yyvsp[0].Number * 60L; } break; case 31: -#line 341 "./getdate.y" +#line 343 "./getdate.y" { yyRelSeconds += yyvsp[-1].Number * yyvsp[0].Number * 60L; } break; case 32: -#line 344 "./getdate.y" +#line 346 "./getdate.y" { yyRelSeconds += yyvsp[0].Number * 60L; } break; case 33: -#line 347 "./getdate.y" +#line 349 "./getdate.y" { yyRelSeconds += yyvsp[-1].Number; } break; case 34: -#line 350 "./getdate.y" +#line 352 "./getdate.y" { yyRelSeconds += yyvsp[-1].Number; } break; case 35: -#line 353 "./getdate.y" +#line 355 "./getdate.y" { yyRelSeconds++; } break; case 36: -#line 356 "./getdate.y" +#line 358 "./getdate.y" { yyRelMonth += yyvsp[-1].Number * yyvsp[0].Number; } break; case 37: -#line 359 "./getdate.y" +#line 361 "./getdate.y" { yyRelMonth += yyvsp[-1].Number * yyvsp[0].Number; } break; case 38: -#line 362 "./getdate.y" +#line 364 "./getdate.y" { yyRelMonth += yyvsp[0].Number; } break; case 39: -#line 367 "./getdate.y" +#line 369 "./getdate.y" { if (yyHaveTime && yyHaveDate && !yyHaveRel) yyYear = yyvsp[0].Number; @@ -1523,18 +1525,18 @@ case 39: } break; case 40: -#line 394 "./getdate.y" +#line 396 "./getdate.y" { yyval.Meridian = MER24; } break; case 41: -#line 397 "./getdate.y" +#line 399 "./getdate.y" { yyval.Meridian = yyvsp[0].Meridian; } break; -#line 1535 "getdate.c" +#line 1537 "getdate.c" } yyssp -= yym; yystate = *yyssp; diff --git a/lib/getdate.y b/lib/getdate.y index 2da7e077b..134a70746 100644 --- a/lib/getdate.y +++ b/lib/getdate.y @@ -72,9 +72,9 @@ */ struct timeb { time_t time; /* Seconds since the epoch */ - unsigned short millitm; /* Field not used */ +/*@unused@*/ unsigned short millitm; /* Field not used */ short timezone; /* Minutes west of GMT */ - short dstflag; /* Field not used */ +/*@unused@*/ short dstflag; /* Field not used */ }; #endif /* defined(HAVE_SYS_TIMEB_H) */ @@ -113,7 +113,9 @@ extern struct tm *gmtime(); extern struct tm *localtime(); #endif +/*@-exportheader@*/ extern time_t get_date(char * p, struct timeb * now); +/*@=exportheader@*/ #define yyparse getdate_yyparse #define yylex getdate_yylex @@ -590,7 +592,7 @@ static TABLE const MilitaryTable[] = { /* ARGSUSED */ static int -yyerror(const char * s) +yyerror(/*@unused@*/ const char * s) { return 0; } diff --git a/lib/header.c b/lib/header.c index ae35db911..23240aba3 100644 --- a/lib/header.c +++ b/lib/header.c @@ -79,7 +79,7 @@ HV_t hdrVec; /* forward reference */ * @return NULL always */ /*@unused@*/ static inline /*@null@*/ void * -_free(/*@only@*/ /*@null@*/ const void * p) /*@modifies *p @*/ +_free(/*@only@*/ /*@null@*/ /*@out@*/ const void * p) /*@modifies *p @*/ { if (p != NULL) free((void *)p); return NULL; @@ -1054,8 +1054,10 @@ indexEntry findEntry(/*@null@*/ Header h, int_32 tag, int_32 type) return entry; last = h->index + h->indexUsed; + /*@-usereleased@*/ /* FIX: entry2 = entry. Code looks bogus as well. */ while (entry2->info.tag == tag && entry2->info.type != type && entry2 < last) entry2++; + /*@=usereleased@*/ if (entry->info.tag == tag && entry->info.type == type) return entry; diff --git a/lib/header.h b/lib/header.h index 8a72c279f..87ca03d01 100644 --- a/lib/header.h +++ b/lib/header.h @@ -180,6 +180,7 @@ typedef int (*headerTagTagFunction) (Header h, * Define header tag output formats. */ typedef /*@abstract@*/ struct headerSprintfExtension_s * headerSprintfExtension; +/*@-fielduse@*/ /* LCL: confused by union? */ struct headerSprintfExtension_s { enum headerSprintfExtenstionType type; /*!< Type of extension. */ /*@observer@*/ /*@null@*/ const char * name; /*!< Name of extension. */ @@ -190,6 +191,7 @@ struct headerSprintfExtension_s { struct headerSprintfExtension_s * more; /*!< Chained table extension. */ } u; }; +/*@=fielduse@*/ /** \ingroup header * Supported default header tag output formats. diff --git a/lib/header_internal.h b/lib/header_internal.h index f5120fcc5..7ae69c62b 100644 --- a/lib/header_internal.h +++ b/lib/header_internal.h @@ -91,8 +91,8 @@ struct extensionCache { /** \ingroup header */ -/*@-fielduse@*/ typedef /*@abstract@*/ struct sprintfToken * sprintfToken; +/*@-fielduse@*/ struct sprintfToken { enum { PTOK_NONE = 0, diff --git a/lib/package.c b/lib/package.c index 46dd09037..683e73ac7 100644 --- a/lib/package.c +++ b/lib/package.c @@ -4,9 +4,7 @@ #include "system.h" -#if !defined(__LCLINT__) #include <netinet/in.h> -#endif /* __LCLINT__ */ #include <rpmlib.h> @@ -19,7 +17,6 @@ /*@access Header@*/ /* XXX compared with NULL */ -/*@-mods@*/ void headerMergeLegacySigs(Header h, const Header sig) { HFD_t hfd = (HFD_t) headerFreeData; @@ -28,7 +25,9 @@ void headerMergeLegacySigs(Header h, const Header sig) int_32 tag, type, count; const void * ptr; + /*@-mods@*/ /* FIX: undocumented modification of sig */ for (hi = headerInitIterator(sig); + /*@=mods@*/ headerNextIterator(hi, &tag, &type, &ptr, &count); ptr = hfd(ptr, type)) { @@ -60,7 +59,9 @@ Header headerRegenSigHeader(const Header h) int_32 tag, stag, type, count; const void * ptr; + /*@-mods@*/ /* FIX: undocumented modification of h */ for (hi = headerInitIterator(h); + /*@=mods@*/ headerNextIterator(hi, &tag, &type, &ptr, &count); ptr = hfd(ptr, type)) { @@ -85,7 +86,6 @@ Header headerRegenSigHeader(const Header h) hi = headerFreeIterator(hi); return sig; } -/*@=mods@*/ /** * Retrieve package components from file handle. @@ -232,7 +232,7 @@ rpmRC rpmReadPackageHeader(FD_t fd, Header * hdrp, int * isSource, int * major, } if (isSource) *isSource = lead.type == RPMLEAD_SOURCE; - /*@-mods@*/ + /*@-mods@*/ /* FIX: undocumented modification */ if (major) *major = lead.major; if (minor) *minor = lead.minor; /*@=mods@*/ diff --git a/lib/problems.c b/lib/problems.c index 2cf3bb593..6e04ac55a 100644 --- a/lib/problems.c +++ b/lib/problems.c @@ -90,7 +90,7 @@ void printDepProblems(FILE * fp, #if !defined(HAVE_VSNPRINTF) || defined(__LCLINT__) /*@-shadow -bufferoverflowhigh @*/ -static inline int vsnprintf(char * buf, /*@unused@*/ int nb, +static inline int vsnprintf(/*@out@*/ char * buf, /*@unused@*/ int nb, const char * fmt, va_list ap) { return vsprintf(buf, fmt, ap); @@ -98,7 +98,7 @@ static inline int vsnprintf(char * buf, /*@unused@*/ int nb, /*@=shadow =bufferoverflowhigh @*/ #endif #if !defined(HAVE_SNPRINTF) || defined(__LCLINT__) -static inline int snprintf(char * buf, int nb, const char * fmt, ...) +static inline int snprintf(/*@out@*/ char * buf, int nb, const char * fmt, ...) { va_list ap; int rc; @@ -227,7 +227,7 @@ void freeFi(TFI_t fi) fi->h = headerFree(fi->h); - /*@-nullstate@*/ + /*@-nullstate@*/ /* FIX: fi->{name,version,release,actions,...,h} NULL */ return; /*@=nullstate@*/ } @@ -365,7 +365,7 @@ static int mergeFiles(TFI_t fi, Header h, Header newH) switch (type) { case RPM_CHAR_TYPE: case RPM_INT8_TYPE: - newdata = xmalloc(fc * sizeof(int_8)); + newdata = xcalloc(fc, sizeof(int_8)); for (j = 0, k = 0; j < count; j++) if (actions[j] != FA_SKIPMULTILIB) ((int_8 *) newdata)[k++] = ((int_8 *) data)[j]; @@ -373,7 +373,7 @@ static int mergeFiles(TFI_t fi, Header h, Header newH) free (newdata); break; case RPM_INT16_TYPE: - newdata = xmalloc(fc * sizeof(int_16)); + newdata = xcalloc(fc, sizeof(int_16)); for (j = 0, k = 0; j < count; j++) if (actions[j] != FA_SKIPMULTILIB) ((int_16 *) newdata)[k++] = ((int_16 *) data)[j]; @@ -381,7 +381,7 @@ static int mergeFiles(TFI_t fi, Header h, Header newH) free (newdata); break; case RPM_INT32_TYPE: - newdata = xmalloc(fc * sizeof(int_32)); + newdata = xcalloc(fc, sizeof(int_32)); for (j = 0, k = 0; j < count; j++) if (actions[j] != FA_SKIPMULTILIB) ((int_32 *) newdata)[k++] = ((int_32 *) data)[j]; @@ -389,7 +389,7 @@ static int mergeFiles(TFI_t fi, Header h, Header newH) free (newdata); break; case RPM_STRING_ARRAY_TYPE: - newdata = xmalloc(fc * sizeof(char *)); + newdata = xcalloc(fc, sizeof(char *)); for (j = 0, k = 0; j < count; j++) if (actions[j] != FA_SKIPMULTILIB) ((char **) newdata)[k++] = ((char **) data)[j]; @@ -413,7 +413,7 @@ static int mergeFiles(TFI_t fi, Header h, Header newH) for (i = 0; i < dirNamesCount; i++) dirNames[i] = ((char **) data)[i]; dirCount = dirNamesCount; - newdata = xmalloc(fc * sizeof(int_32)); + newdata = xcalloc(fc, sizeof(int_32)); for (i = 0, k = 0; i < count; i++) { if (actions[i] == FA_SKIPMULTILIB) continue; diff --git a/lib/rpmchecksig.c b/lib/rpmchecksig.c index 1cc158bda..7163c8955 100644 --- a/lib/rpmchecksig.c +++ b/lib/rpmchecksig.c @@ -356,14 +356,10 @@ int rpmCheckSig(rpmCheckSigFlags flags, const char ** argv) if (tempKey) { if (res3 == RPMSIG_NOKEY) { strcat(missingKeys, " PGP#"); - /*@-compdef@*/ strncat(missingKeys, tempKey + offset, 8); - /*@=compdef@*/ } else { strcat(untrustedKeys, " PGP#"); - /*@-compdef@*/ strncat(untrustedKeys, tempKey + offset, 8); - /*@=compdef@*/ } } } break; @@ -381,9 +377,7 @@ int rpmCheckSig(rpmCheckSigFlags flags, const char ** argv) strcat(missingKeys, " GPG#"); tempKey = strstr(result, "key ID"); if (tempKey) - /*@-compdef@*/ strncat(missingKeys, tempKey+7, 8); - /*@=compdef@*/ break; default: strcat(buffer, "GPG "); diff --git a/lib/rpmcli.h b/lib/rpmcli.h index f48cd39bf..7289c5072 100644 --- a/lib/rpmcli.h +++ b/lib/rpmcli.h @@ -320,6 +320,7 @@ struct rpmInstallArguments_s { /** * A rollback transaction id element. */ +/*@-fielduse@*/ typedef /*@abstract@*/ struct IDT_s { unsigned int instance; /*!< installed package transaction id. */ /*@owned@*/ /*@null@*/ const char * key; /*! removed package file name. */ @@ -328,6 +329,7 @@ typedef /*@abstract@*/ struct IDT_s { int_32 i32; /*!< install/remove transaction id */ } val; } * IDT; +/*@=fielduse@*/ /** * A rollback transaction id index. diff --git a/lib/rpminstall.c b/lib/rpminstall.c index 715c47ce6..bcde9aa32 100644 --- a/lib/rpminstall.c +++ b/lib/rpminstall.c @@ -676,10 +676,8 @@ int rpmInstallSource(const char * rootdir, const char * arg, fprintf(stdout, _("Installing %s\n"), arg); { - /*@-mayaliasunique@*/ rpmRC rpmrc = rpmInstallSourcePackage(rootdir, fd, specFile, NULL, NULL, cookie); - /*@=mayaliasunique@*/ rc = (rpmrc == RPMRC_OK ? 0 : 1); } if (rc != 0) { diff --git a/lib/rpmlead.c b/lib/rpmlead.c index 366b05be1..7d325b321 100644 --- a/lib/rpmlead.c +++ b/lib/rpmlead.c @@ -8,9 +8,7 @@ # include <machine/types.h> #endif -#if !defined(__LCLINT__) #include <netinet/in.h> -#endif /* __LCLINT__ */ #include <rpmlib.h> diff --git a/lib/rpmlib.h b/lib/rpmlib.h index 30eb02fb0..3194a313b 100644 --- a/lib/rpmlib.h +++ b/lib/rpmlib.h @@ -37,7 +37,7 @@ extern "C" { * @return NULL always */ /*@unused@*/ static inline /*@null@*/ void * -_free(/*@only@*/ /*@null@*/ const void * p) +_free(/*@only@*/ /*@null@*/ /*@out@*/ const void * p) /*@modifies p @*/ { if (p != NULL) free((void *)p); diff --git a/lib/rpmrc.c b/lib/rpmrc.c index 8383ab263..2f7ccc042 100644 --- a/lib/rpmrc.c +++ b/lib/rpmrc.c @@ -307,10 +307,13 @@ static int addCanon(canonEntry * table, int * tableLen, char * line, const char * tshort_name; int tnum; +#ifdef DYING if (! *tableLen) { *tableLen = 2; *table = xmalloc(2 * sizeof(struct canonEntry_s)); - } else { + } else +#endif + { (*tableLen) += 2; /*@-unqualifiedtrans@*/ *table = xrealloc(*table, sizeof(struct canonEntry_s) * (*tableLen)); @@ -360,10 +363,13 @@ static int addDefault(defaultEntry * table, int * tableLen, char * line, { defaultEntry t; +#ifdef DYING if (! *tableLen) { *tableLen = 1; *table = xmalloc(sizeof(struct defaultEntry_s)); - } else { + } else +#endif + { (*tableLen)++; /*@-unqualifiedtrans@*/ *table = xrealloc(*table, sizeof(struct defaultEntry_s) * (*tableLen)); diff --git a/lib/signature.c b/lib/signature.c index e3cafc4b2..75dfd106e 100644 --- a/lib/signature.c +++ b/lib/signature.c @@ -201,11 +201,9 @@ rpmRC rpmReadSignature(FD_t fd, Header * headerp, sigType sig_type) break; } - if (rc == 0 && headerp) - /*@-nullderef@*/ + if (headerp && rc == 0) *headerp = h; - /*@=nullderef@*/ - else if (h) + else h = headerFree(h); return rc; diff --git a/lib/stringbuf.c b/lib/stringbuf.c index b5c1cfa8d..110136bfd 100644 --- a/lib/stringbuf.c +++ b/lib/stringbuf.c @@ -29,7 +29,7 @@ struct StringBufRec { * @return NULL always */ /*@unused@*/ static inline /*@null@*/ void * -_free(/*@only@*/ /*@null@*/ const void * p) /*@modifies *p @*/ +_free(/*@only@*/ /*@null@*/ /*@out@*/ const void * p) /*@modifies *p @*/ { if (p != NULL) free((void *)p); return NULL; @@ -93,7 +93,7 @@ void appendStringBufAux(StringBuf sb, const char *s, int nl) sb->tail = sb->buf + (sb->allocated - sb->free); } - /*@-mayaliasunique@*/ + /*@-mayaliasunique@*/ /* FIX: shrug */ strcpy(sb->tail, s); /*@=mayaliasunique@*/ sb->tail += l; diff --git a/lib/transaction.c b/lib/transaction.c index 2aee300c0..230be8557 100644 --- a/lib/transaction.c +++ b/lib/transaction.c @@ -125,7 +125,7 @@ static rpmProblemSet psCreate(void) { rpmProblemSet probs; - probs = xmalloc(sizeof(*probs)); /* XXX memory leak */ + probs = xcalloc(1, sizeof(*probs)); /* XXX memory leak */ probs->numProblems = probs->numProblemsAlloced = 0; probs->probs = NULL; @@ -136,7 +136,7 @@ static void psAppend(rpmProblemSet probs, rpmProblemType type, const struct availablePackage * alp, const char * dn, const char *bn, Header altH, unsigned long ulong1) - /*@modifies probs, alp @*/ + /*@modifies *probs, alp @*/ { rpmProblem p; char *t; @@ -150,50 +150,51 @@ static void psAppend(rpmProblemSet probs, rpmProblemType type, probs->numProblemsAlloced * sizeof(*probs->probs)); } - p = probs->probs + probs->numProblems++; + p = probs->probs + probs->numProblems; + probs->numProblems++; + memset(p, 0, sizeof(*p)); p->type = type; /*@-assignexpose@*/ p->key = alp->key; /*@=assignexpose@*/ p->ulong1 = ulong1; p->ignoreProblem = 0; + p->str1 = NULL; + p->h = NULL; + p->pkgNEVR = NULL; + p->altNEVR = NULL; if (dn || bn) { p->str1 = - t = xmalloc((dn ? strlen(dn) : 0) + (bn ? strlen(bn) : 0) + 1); + t = xcalloc(1, (dn ? strlen(dn) : 0) + (bn ? strlen(bn) : 0) + 1); if (dn) t = stpcpy(t, dn); if (bn) t = stpcpy(t, bn); - } else - p->str1 = NULL; + } if (alp) { p->h = headerLink(alp->h); p->pkgNEVR = - t = xmalloc(strlen(alp->name) + - strlen(alp->version) + - strlen(alp->release) + sizeof("--")); + t = xcalloc(1, strlen(alp->name) + + strlen(alp->version) + + strlen(alp->release) + sizeof("--")); t = stpcpy(t, alp->name); t = stpcpy(t, "-"); t = stpcpy(t, alp->version); t = stpcpy(t, "-"); t = stpcpy(t, alp->release); - } else { - p->h = NULL; - p->pkgNEVR = NULL; } if (altH) { const char * n, * v, * r; (void) headerNVR(altH, &n, &v, &r); p->altNEVR = - t = xmalloc(strlen(n) + strlen(v) + strlen(r) + sizeof("--")); + t = xcalloc(1, strlen(n) + strlen(v) + strlen(r) + sizeof("--")); t = stpcpy(t, n); t = stpcpy(t, "-"); t = stpcpy(t, v); t = stpcpy(t, "-"); t = stpcpy(t, r); - } else - p->altNEVR = NULL; + } } static int archOkay(Header h) @@ -1576,7 +1577,7 @@ int rpmRunTransactions( rpmTransactionSet ts, struct stat sb; ts->di = _free(ts->di); - dip = ts->di = xcalloc(sizeof(*ts->di), ts->filesystemCount + 1); + dip = ts->di = xcalloc((ts->filesystemCount + 1), sizeof(*ts->di)); for (i = 0; (i < ts->filesystemCount) && dip; i++) { #if STATFS_IN_SYS_STATVFS @@ -1822,7 +1823,7 @@ int rpmRunTransactions( rpmTransactionSet ts, if (fi->fc == 0) continue; /* Extract file info for all files in this package from the database. */ - matches = xcalloc(sizeof(*matches), fi->fc); + matches = xcalloc(fi->fc, sizeof(*matches)); if (rpmdbFindFpList(ts->rpmdb, fi->fps, matches, fi->fc)) return 1; /* XXX WTFO? */ @@ -1831,7 +1832,7 @@ int rpmRunTransactions( rpmTransactionSet ts, numShared += dbiIndexSetCount(matches[i]); /* Build sorted file info list for this package. */ - shared = sharedList = xmalloc((numShared + 1) * sizeof(*sharedList)); + shared = sharedList = xcalloc((numShared + 1), sizeof(*sharedList)); for (i = 0; i < fi->fc; i++) { /* * Take care not to mark files as replaced in packages that will |