diff options
author | Neal Norwitz <nnorwitz@gmail.com> | 2008-03-28 04:58:51 (GMT) |
---|---|---|
committer | Neal Norwitz <nnorwitz@gmail.com> | 2008-03-28 04:58:51 (GMT) |
commit | d183bdd6fb77ae562714c655f0689beacdc00da1 (patch) | |
tree | fefb66dad02e0e67e3060459b4501a70f455eb00 /Include | |
parent | 36550bdde947ef7cad57d1375fbcf6096b017231 (diff) | |
download | cpython-d183bdd6fb77ae562714c655f0689beacdc00da1.zip cpython-d183bdd6fb77ae562714c655f0689beacdc00da1.tar.gz cpython-d183bdd6fb77ae562714c655f0689beacdc00da1.tar.bz2 |
Revert r61969 which added casts to Py_CHARMASK to avoid compiler warnings.
Rather than sprinkle casts throughout the code, change Py_CHARMASK to
always cast it's result to an unsigned char. This should ensure we
do the right thing when accessing an array with the result.
Diffstat (limited to 'Include')
-rw-r--r-- | Include/Python.h | 2 | ||||
-rw-r--r-- | Include/bytes_methods.h | 14 |
2 files changed, 8 insertions, 8 deletions
diff --git a/Include/Python.h b/Include/Python.h index a5e2853..4cffda3 100644 --- a/Include/Python.h +++ b/Include/Python.h @@ -148,7 +148,7 @@ PyAPI_FUNC(PyObject*) _Py_Mangle(PyObject *p, PyObject *name); #ifdef __CHAR_UNSIGNED__ #define Py_CHARMASK(c) (c) #else -#define Py_CHARMASK(c) ((c) & 0xff) +#define Py_CHARMASK(c) ((unsigned char)((c) & 0xff)) #endif #include "pyfpe.h" diff --git a/Include/bytes_methods.h b/Include/bytes_methods.h index a05e11f..59873f2 100644 --- a/Include/bytes_methods.h +++ b/Include/bytes_methods.h @@ -44,13 +44,13 @@ extern const char _Py_swapcase__doc__[]; extern const unsigned int _Py_ctype_table[256]; -#define ISLOWER(c) (_Py_ctype_table[(unsigned)Py_CHARMASK(c)] & FLAG_LOWER) -#define ISUPPER(c) (_Py_ctype_table[(unsigned)Py_CHARMASK(c)] & FLAG_UPPER) -#define ISALPHA(c) (_Py_ctype_table[(unsigned)Py_CHARMASK(c)] & FLAG_ALPHA) -#define ISDIGIT(c) (_Py_ctype_table[(unsigned)Py_CHARMASK(c)] & FLAG_DIGIT) -#define ISXDIGIT(c) (_Py_ctype_table[(unsigned)Py_CHARMASK(c)] & FLAG_XDIGIT) -#define ISALNUM(c) (_Py_ctype_table[(unsigned)Py_CHARMASK(c)] & FLAG_ALNUM) -#define ISSPACE(c) (_Py_ctype_table[(unsigned)Py_CHARMASK(c)] & FLAG_SPACE) +#define ISLOWER(c) (_Py_ctype_table[Py_CHARMASK(c)] & FLAG_LOWER) +#define ISUPPER(c) (_Py_ctype_table[Py_CHARMASK(c)] & FLAG_UPPER) +#define ISALPHA(c) (_Py_ctype_table[Py_CHARMASK(c)] & FLAG_ALPHA) +#define ISDIGIT(c) (_Py_ctype_table[Py_CHARMASK(c)] & FLAG_DIGIT) +#define ISXDIGIT(c) (_Py_ctype_table[Py_CHARMASK(c)] & FLAG_XDIGIT) +#define ISALNUM(c) (_Py_ctype_table[Py_CHARMASK(c)] & FLAG_ALNUM) +#define ISSPACE(c) (_Py_ctype_table[Py_CHARMASK(c)] & FLAG_SPACE) #undef islower #define islower(c) undefined_islower(c) |