[Python-Dev] cpython: fix compiler warning by implementing this more cleverly (original) (raw)
Antoine Pitrou solipsis at pitrou.net
Tue Nov 22 22:32:11 CET 2011
- Previous message: [Python-Dev] [Python-checkins] cpython: sort last committed name in alphabetical order
- Next message: [Python-Dev] cpython: fix compiler warning by implementing this more cleverly
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
On Tue, 22 Nov 2011 21:29:43 +0100 benjamin.peterson <python-checkins at python.org> wrote:
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
You mean "more obscurely"? Obfuscating the original intent in order to disable a compiler warning doesn't seem very wise to me.
Regards
Antoine.
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 = PyUnicodeKIND(unicode); data = PyUnicodeDATA(unicode); len = PyUnicodeGETLENGTH(unicode); - - switch(kind) { - case PyUnicode1BYTEKIND: expandsize = 4; break; - case PyUnicode2BYTEKIND: expandsize = 6; break; - case PyUnicode4BYTEKIND: expandsize = 10; break; - } + expandsize = kind * 2 + 2; if (len > PYSSIZETMAX / expandsize) return PyErrNoMemory(); -- Repository URL: http://hg.python.org/cpython
- Previous message: [Python-Dev] [Python-checkins] cpython: sort last committed name in alphabetical order
- Next message: [Python-Dev] cpython: fix compiler warning by implementing this more cleverly
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]