mirror of
https://github.com/python/cpython.git
synced 2025-07-29 06:05:00 +00:00
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
1 changed files with 68 additions and 73 deletions
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 *
|
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;
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue