From 02686751931e6cd267f60c65b59744c7dff50cd2 Mon Sep 17 00:00:00 2001 From: Benjamin Peterson Date: Tue, 22 Nov 2011 15:29:32 -0500 Subject: fix compiler warning by implementing this more cleverly --- Objects/unicodeobject.c | 7 +------ 1 file changed, 1 insertion(+), 6 deletions(-) diff --git a/Objects/unicodeobject.c b/Objects/unicodeobject.c index ff22f85..a7d9e12 100644 --- a/Objects/unicodeobject.c +++ b/Objects/unicodeobject.c @@ -6164,12 +6164,7 @@ PyUnicode_AsRawUnicodeEscapeString(PyObject *unicode) 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(); -- cgit v0.12