[Python-checkins] cpython: fix compiler warning by implementing this more cleverly
benjamin.peterson
python-checkins at python.org
Tue Nov 22 21:29:43 CET 2011
http://hg.python.org/cpython/rev/77ab830930ae
changeset: 73697:77ab830930ae
user: Benjamin Peterson <benjamin at python.org>
date: Tue Nov 22 15:29:32 2011 -0500
summary:
fix compiler warning by implementing this more cleverly
files:
Objects/unicodeobject.c | 7 +------
1 files changed, 1 insertions(+), 6 deletions(-)
diff --git a/Objects/unicodeobject.c b/Objects/unicodeobject.c
--- a/Objects/unicodeobject.c
+++ b/Objects/unicodeobject.c
@@ -6164,12 +6164,7 @@
kind = PyUnicode_KIND(unicode);
data = PyUnicode_DATA(unicode);
len = PyUnicode_GET_LENGTH(unicode);
-
- switch(kind) {
- case PyUnicode_1BYTE_KIND: expandsize = 4; break;
- case PyUnicode_2BYTE_KIND: expandsize = 6; break;
- case PyUnicode_4BYTE_KIND: expandsize = 10; break;
- }
+ expandsize = kind * 2 + 2;
if (len > PY_SSIZE_T_MAX / expandsize)
return PyErr_NoMemory();
--
Repository URL: http://hg.python.org/cpython
More information about the Python-checkins
mailing list