From b081e0c74ca2c033adb075750cb32b47bb380d50 Mon Sep 17 00:00:00 2001 From: Guido van Rossum Date: Fri, 16 Aug 2002 01:57:32 +0000 Subject: Minor cleanup of parsename() and parsestr(): the 'struct compiling *' argument should be called 'c', like everywhere else. Renamed a complex variable 'c' to 'z' and moved it inside the only scope where it's used. --- Python/compile.c | 26 +++++++++++++------------- 1 file changed, 13 insertions(+), 13 deletions(-) diff --git a/Python/compile.c b/Python/compile.c index ff8f4a5..e448dd2 100644 --- a/Python/compile.c +++ b/Python/compile.c @@ -1133,13 +1133,12 @@ com_addopname(struct compiling *c, int op, node *n) } static PyObject * -parsenumber(struct compiling *co, char *s) +parsenumber(struct compiling *c, char *s) { char *end; long x; double dx; #ifndef WITHOUT_COMPLEX - Py_complex c; int imflag; #endif @@ -1158,8 +1157,8 @@ parsenumber(struct compiling *co, char *s) "hex/oct constants > sys.maxint " "will return positive values " "in Python 2.4 and up", - co->c_filename, - co->c_lineno, + c->c_filename, + c->c_lineno, NULL, NULL) < 0) return NULL; @@ -1176,11 +1175,12 @@ parsenumber(struct compiling *co, char *s) /* XXX Huge floats may silently fail */ #ifndef WITHOUT_COMPLEX if (imflag) { - c.real = 0.; + Py_complex z; + z.real = 0.; PyFPE_START_PROTECT("atof", return 0) - c.imag = atof(s); - PyFPE_END_PROTECT(c) - return PyComplex_FromCComplex(c); + z.imag = atof(s); + PyFPE_END_PROTECT(z) + return PyComplex_FromCComplex(z); } else #endif @@ -1215,7 +1215,7 @@ decode_utf8(char **sPtr, char *end, char* encoding) } static PyObject * -parsestr(struct compiling *com, char *s) +parsestr(struct compiling *c, char *s) { PyObject *v; size_t len; @@ -1224,7 +1224,7 @@ parsestr(struct compiling *com, char *s) char *end; int quote = *s; int rawmode = 0; - char* encoding = ((com == NULL) ? NULL : com->c_encoding); + char* encoding = ((c == NULL) ? NULL : c->c_encoding); int need_encoding; int unicode = 0; @@ -1245,7 +1245,7 @@ parsestr(struct compiling *com, char *s) s++; len = strlen(s); if (len > INT_MAX) { - com_error(com, PyExc_OverflowError, + com_error(c, PyExc_OverflowError, "string to parse is too long"); return NULL; } @@ -1315,7 +1315,7 @@ parsestr(struct compiling *com, char *s) v = PyUnicode_DecodeUnicodeEscape(buf, len, NULL); Py_XDECREF(u); if (v == NULL) - PyErr_SyntaxLocation(com->c_filename, com->c_lineno); + PyErr_SyntaxLocation(c->c_filename, c->c_lineno); return v; } @@ -1345,7 +1345,7 @@ parsestr(struct compiling *com, char *s) v = PyString_DecodeEscape(s, len, NULL, unicode, need_encoding ? encoding : NULL); if (v == NULL) - PyErr_SyntaxLocation(com->c_filename, com->c_lineno); + PyErr_SyntaxLocation(c->c_filename, c->c_lineno); return v; } -- cgit v0.12