summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorWalter Dörwald <walter@livinglogic.de>2007-05-12 11:13:47 (GMT)
committerWalter Dörwald <walter@livinglogic.de>2007-05-12 11:13:47 (GMT)
commitdb5d33e4eeefa9875b17ea6a24d28e7d7e17b4ad (patch)
treef70357e93fca02331477149561213c81b4599f93
parent79e913eac771bde5260160f9eebf475094d82aeb (diff)
downloadcpython-db5d33e4eeefa9875b17ea6a24d28e7d7e17b4ad.zip
cpython-db5d33e4eeefa9875b17ea6a24d28e7d7e17b4ad.tar.gz
cpython-db5d33e4eeefa9875b17ea6a24d28e7d7e17b4ad.tar.bz2
Reuse static global hexdigits array.
-rw-r--r--Objects/unicodeobject.c26
1 files changed, 12 insertions, 14 deletions
diff --git a/Objects/unicodeobject.c b/Objects/unicodeobject.c
index 6106980..975f192 100644
--- a/Objects/unicodeobject.c
+++ b/Objects/unicodeobject.c
@@ -2362,8 +2362,6 @@ PyObject *PyUnicode_EncodeRawUnicodeEscape(const Py_UNICODE *s,
char *p;
char *q;
- static const char *hexdigit = "0123456789abcdef";
-
#ifdef Py_UNICODE_WIDE
repr = PyString_FromStringAndSize(NULL, 10 * size);
#else
@@ -2382,14 +2380,14 @@ PyObject *PyUnicode_EncodeRawUnicodeEscape(const Py_UNICODE *s,
if (ch >= 0x10000) {
*p++ = '\\';
*p++ = 'U';
- *p++ = hexdigit[(ch >> 28) & 0xf];
- *p++ = hexdigit[(ch >> 24) & 0xf];
- *p++ = hexdigit[(ch >> 20) & 0xf];
- *p++ = hexdigit[(ch >> 16) & 0xf];
- *p++ = hexdigit[(ch >> 12) & 0xf];
- *p++ = hexdigit[(ch >> 8) & 0xf];
- *p++ = hexdigit[(ch >> 4) & 0xf];
- *p++ = hexdigit[ch & 15];
+ *p++ = hexdigits[(ch >> 28) & 0xf];
+ *p++ = hexdigits[(ch >> 24) & 0xf];
+ *p++ = hexdigits[(ch >> 20) & 0xf];
+ *p++ = hexdigits[(ch >> 16) & 0xf];
+ *p++ = hexdigits[(ch >> 12) & 0xf];
+ *p++ = hexdigits[(ch >> 8) & 0xf];
+ *p++ = hexdigits[(ch >> 4) & 0xf];
+ *p++ = hexdigits[ch & 15];
}
else
#endif
@@ -2397,10 +2395,10 @@ PyObject *PyUnicode_EncodeRawUnicodeEscape(const Py_UNICODE *s,
if (ch >= 256) {
*p++ = '\\';
*p++ = 'u';
- *p++ = hexdigit[(ch >> 12) & 0xf];
- *p++ = hexdigit[(ch >> 8) & 0xf];
- *p++ = hexdigit[(ch >> 4) & 0xf];
- *p++ = hexdigit[ch & 15];
+ *p++ = hexdigits[(ch >> 12) & 0xf];
+ *p++ = hexdigits[(ch >> 8) & 0xf];
+ *p++ = hexdigits[(ch >> 4) & 0xf];
+ *p++ = hexdigits[ch & 15];
}
/* Copy everything else as-is */
else