RPM Package Manager, CVS Repository http://rpm5.org/cvs/ ____________________________________________________________________________
Server: rpm5.org Name: Jeff Johnson Root: /v/rpm/cvs Email: [email protected] Module: popt Date: 26-Jul-2009 18:38:25 Branch: HEAD Handle: 2009072616382500 Modified files: popt popt.c popt.h test1.c Log: - splint fiddles. Summary: Revision Changes Path 1.135 +10 -8 popt/popt.c 1.76 +5 -3 popt/popt.h 1.44 +2 -2 popt/test1.c ____________________________________________________________________________ patch -p0 <<'@@ .' Index: popt/popt.c ============================================================================ $ cvs diff -u -r1.134 -r1.135 popt.c --- popt/popt.c 26 Jul 2009 16:25:23 -0000 1.134 +++ popt/popt.c 26 Jul 2009 16:38:25 -0000 1.135 @@ -759,7 +759,10 @@ /*...@unchecked@*/ unsigned int _poptBitsK = _POPT_BITS_K; -static int _poptBitsNew(poptBits *bitsp) +/*...@-sizeoftype@*/ +static int _poptBitsNew(/*...@null@*/ poptBits *bitsp) + /*...@globals _poptBitsN, _poptBitsM, _poptBitsK @*/ + /*...@modifies *bitsp, _poptBitsN, _poptBitsM, _poptBitsK @*/ { if (bitsp == NULL) return POPT_ERROR_NULLARG; @@ -774,10 +777,11 @@ if (_poptBitsK == 0U || _poptBitsK > 32U) _poptBitsK = _POPT_BITS_K; *bitsp = PBM_ALLOC(_poptBitsM-1); } +/*...@-nullstate@*/ return 0; +/*...@=nullstate@*/ } -/*...@-sizeoftype@*/ int poptBitsAdd(poptBits bits, const char * s) { size_t ns = (s ? strlen(s) : 0); @@ -858,7 +862,7 @@ size_t nw = (__PBM_IX(_poptBitsM-1) + 1); size_t i; - if (_poptBitsNew(ap) || b == NULL) + if (ap == NULL || b == NULL || _poptBitsNew(ap)) return POPT_ERROR_NULLARG; abits = __PBM_BITS(*ap); bbits = __PBM_BITS(b); @@ -878,7 +882,7 @@ size_t nw = (__PBM_IX(_poptBitsM-1) + 1); size_t i; - if (_poptBitsNew(ap) || b == NULL) + if (ap == NULL || b == NULL || _poptBitsNew(ap)) return POPT_ERROR_NULLARG; abits = __PBM_BITS(*ap); bbits = __PBM_BITS(b); @@ -897,7 +901,7 @@ char *t, *te; int rc = 0; - if (_poptBitsNew(bitsp) || s == NULL || *s == '\0') + if (bitsp == NULL || s == NULL || *s == '\0' || _poptBitsNew(bitsp)) return POPT_ERROR_NULLARG; /* Parse comma separated attributes. */ @@ -905,7 +909,7 @@ while ((t = te) != NULL && *t) { while (*te != '\0' && *te != ',') te++; - if (*te) + if (*te != '\0') *te++ = '\0'; /* XXX Ignore empty strings. */ if (*t == '\0') @@ -917,10 +921,8 @@ rc = poptBitsDel(*bitsp, t); } else rc = poptBitsAdd(*bitsp, t); -/*...@-nullstate@*/ if (rc) break; -/*...@=nullstate@*/ } tbuf = _free(tbuf); return rc; @@ . patch -p0 <<'@@ .' Index: popt/popt.h ============================================================================ $ cvs diff -u -r1.75 -r1.76 popt.h --- popt/popt.h 26 Jul 2009 16:25:23 -0000 1.75 +++ popt/popt.h 26 Jul 2009 16:38:25 -0000 1.76 @@ -690,24 +690,26 @@ #define _POPT_BITS_M ((3U * _POPT_BITS_N) / 2U) #define _POPT_BITS_K 16U /* no. of linear hash combinations */ -/*...@-exportlocal -export...@*/ +/*...@-exportlocal -exportvar -globuse @*/ /*...@unchecked@*/ extern unsigned int _poptBitsN; /*...@unchecked@*/ extern unsigned int _poptBitsM; /*...@unchecked@*/ extern unsigned int _poptBitsK; -/*...@=exportlocal =export...@*/ +/*...@=exportlocal =exportvar =globuse @*/ +/*...@-exportlocal@*/ int poptBitsAdd(/*...@null@*/poptBits bits, /*...@null@*/const char * s) /*...@modifies bits @*/; +/*...@=exportlocal@*/ int poptBitsChk(/*...@null@*/poptBits bits, /*...@null@*/const char * s) /*...@*/; int poptBitsClr(/*...@null@*/poptBits bits) /*...@modifies bits @*/; +/*...@-exportlocal@*/ int poptBitsDel(/*...@null@*/poptBits bits, /*...@null@*/const char * s) /*...@modifies bits @*/; -/*...@-exportlocal@*/ /*...@-fcnuse@*/ int poptBitsIntersect(/*...@null@*/ poptBits * ap, /*...@null@*/ const poptBits b) /*...@modifies *ap @*/; @@ . patch -p0 <<'@@ .' Index: popt/test1.c ============================================================================ $ cvs diff -u -r1.43 -r1.44 test1.c --- popt/test1.c 26 Jul 2009 16:25:23 -0000 1.43 +++ popt/test1.c 26 Jul 2009 16:38:25 -0000 1.44 @@ -66,7 +66,7 @@ static const char ** aArgv = NULL; /*...@unchecked@*/ /*...@only@*/ /*...@null@*/ static void * aBits = NULL; -/*...@unchecked@*/ +/*...@unchecked@*/ /*...@observer@*/ static const char *attributes[] = { "foo", "bar", "baz", "bing", "bang", "boom" }; @@ -223,7 +223,7 @@ aArgv = NULL; } if (aBits) - poptBitsClr(aBits); + (void) poptBitsClr(aBits); oStr = (char *) -1; @@ . ______________________________________________________________________ RPM Package Manager http://rpm5.org CVS Sources Repository [email protected]
