Remove two unneeded branches to an 'if' statement by applying De Morgan's Law

and creating a single 'if' statement along with a NULL default value for a
variable.

Also clean up a bunch of whitespace.

Found using Clang's static analyzer.
This commit is contained in:
Brett Cannon 2010-05-05 20:30:30 +00:00
parent 2ee5183852
commit fa84d923ec
1 changed files with 68 additions and 73 deletions

View File

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