mirror of https://github.com/python/cpython
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:
parent
2ee5183852
commit
fa84d923ec
11
Python/ast.c
11
Python/ast.c
|
@ -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;
|
||||
|
|
Loading…
Reference in New Issue