Remove three unneeded variable assignments.

Found using Clang's static analyzer.
This commit is contained in:
Brett Cannon 2010-05-05 20:20:19 +00:00
parent 8a478ced55
commit 0b03f10afb
5 changed files with 79 additions and 89 deletions

View File

@ -3378,17 +3378,12 @@ decode_utf8(struct compiling *c, const char **sPtr, const char *end, char* encod
static PyObject * static PyObject *
decode_unicode(struct compiling *c, const char *s, size_t len, int rawmode, const char *encoding) decode_unicode(struct compiling *c, const char *s, size_t len, int rawmode, const char *encoding)
{ {
PyObject *v, *u; PyObject *v;
PyObject *u = NULL;
char *buf; char *buf;
char *p; char *p;
const char *end; const char *end;
if (encoding == NULL) { if (encoding != NULL && strcmp(encoding, "iso-8859-1")) {
buf = (char *)s;
u = NULL;
} else if (strcmp(encoding, "iso-8859-1") == 0) {
buf = (char *)s;
u = NULL;
} else {
/* check for integer overflow */ /* check for integer overflow */
if (len > PY_SIZE_MAX / 6) if (len > PY_SIZE_MAX / 6)
return NULL; return NULL;

View File

@ -2697,7 +2697,6 @@ PyEval_EvalFrameEx(PyFrameObject *f, int throwflag)
Py_DECREF(*pfunc); Py_DECREF(*pfunc);
*pfunc = self; *pfunc = self;
na++; na++;
n++;
} else } else
Py_INCREF(func); Py_INCREF(func);
sp = stack_pointer; sp = stack_pointer;

View File

@ -1382,7 +1382,6 @@ bigcomp(U *rv, const char *s0, BCinfo *bc)
Bigint *b, *d; Bigint *b, *d;
int b2, d2, dd, i, nd, nd0, odd, p2, p5; int b2, d2, dd, i, nd, nd0, odd, p2, p5;
dd = 0; /* silence compiler warning about possibly unused variable */
nd = bc->nd; nd = bc->nd;
nd0 = bc->nd0; nd0 = bc->nd0;
p5 = nd + bc->e0; p5 = nd + bc->e0;
@ -2362,7 +2361,7 @@ _Py_dg_dtoa(double dd, int mode, int ndigits,
/* set pointers to NULL, to silence gcc compiler warnings and make /* set pointers to NULL, to silence gcc compiler warnings and make
cleanup easier on error */ cleanup easier on error */
mlo = mhi = b = S = 0; mlo = mhi = S = 0;
s0 = 0; s0 = 0;
u.d = dd; u.d = dd;
@ -2713,8 +2712,6 @@ _Py_dg_dtoa(double dd, int mode, int ndigits,
* and for all and pass them and a shift to quorem, so it * and for all and pass them and a shift to quorem, so it
* can do shifts and ors to compute the numerator for q. * can do shifts and ors to compute the numerator for q.
*/ */
if ((i = ((s5 ? 32 - hi0bits(S->x[S->wds-1]) : 1) + s2) & 0x1f))
i = 32 - i;
#define iInc 28 #define iInc 28
i = dshift(S, s2); i = dshift(S, s2);
b2 += i; b2 += i;

View File

@ -59,14 +59,13 @@ getcwd(char *buf, int size)
{ {
FILE *fp; FILE *fp;
char *p; char *p;
int sts;
if (size <= 0) { if (size <= 0) {
errno = EINVAL; errno = EINVAL;
return NULL; return NULL;
} }
if ((fp = popen(PWD_CMD, "r")) == NULL) if ((fp = popen(PWD_CMD, "r")) == NULL)
return NULL; return NULL;
if (fgets(buf, size, fp) == NULL || (sts = pclose(fp)) != 0) { if (fgets(buf, size, fp) == NULL || pclose(fp) != 0) {
errno = EACCES; /* Most likely error */ errno = EACCES; /* Most likely error */
return NULL; return NULL;
} }