From dc2fd5101a22d82600a328158f484e74e976d12b Mon Sep 17 00:00:00 2001 From: Serhiy Storchaka Date: Tue, 19 Nov 2013 15:56:05 +0200 Subject: [PATCH] Remove dead code committed in issue #12892. --- Objects/stringlib/codecs.h | 104 ------------------------------------- 1 file changed, 104 deletions(-) diff --git a/Objects/stringlib/codecs.h b/Objects/stringlib/codecs.h index 14fdc6c0832..2eb2d1412ff 100644 --- a/Objects/stringlib/codecs.h +++ b/Objects/stringlib/codecs.h @@ -596,110 +596,6 @@ IllegalSurrogate: #undef SWAB -#if STRINGLIB_MAX_CHAR >= 0x80 -Py_LOCAL_INLINE(Py_ssize_t) -STRINGLIB(utf16_encode_)(const STRINGLIB_CHAR *in, - Py_ssize_t len, - unsigned short **outptr, - int native_ordering) -{ - unsigned short *out = *outptr; - const STRINGLIB_CHAR *end = in + len; -#if STRINGLIB_SIZEOF_CHAR == 1 -# define SWAB2(CH) ((CH) << 8) -#else -# define SWAB2(CH) (((CH) << 8) | ((CH) >> 8)) -#endif - if (native_ordering) { -#if STRINGLIB_MAX_CHAR < 0x10000 - const STRINGLIB_CHAR *unrolled_end = in + _Py_SIZE_ROUND_DOWN(len, 4); - while (in < unrolled_end) { -# if STRINGLIB_MAX_CHAR >= 0xd800 - if (((in[0] ^ 0xd800) & - (in[1] ^ 0xd800) & - (in[2] ^ 0xd800) & - (in[3] ^ 0xd800) & 0xf800) == 0) - break; -# endif - out[0] = in[0]; - out[1] = in[1]; - out[2] = in[2]; - out[3] = in[3]; - in += 4; out += 4; - } -#endif - while (in < end) { - Py_UCS4 ch; - ch = *in++; -#if STRINGLIB_MAX_CHAR >= 0xd800 - if (ch < 0xd800) - *out++ = ch; - else if (ch < 0xe000) - /* reject surrogate characters (U+DC800-U+DFFF) */ - goto fail; -# if STRINGLIB_MAX_CHAR >= 0x10000 - else if (ch >= 0x10000) { - out[0] = Py_UNICODE_HIGH_SURROGATE(ch); - out[1] = Py_UNICODE_LOW_SURROGATE(ch); - out += 2; - } -# endif - else -#endif - *out++ = ch; - } - } else { -#if STRINGLIB_MAX_CHAR < 0x10000 - const STRINGLIB_CHAR *unrolled_end = in + _Py_SIZE_ROUND_DOWN(len, 4); - while (in < unrolled_end) { -# if STRINGLIB_MAX_CHAR >= 0xd800 - if (((in[0] ^ 0xd800) & - (in[1] ^ 0xd800) & - (in[2] ^ 0xd800) & - (in[3] ^ 0xd800) & 0xf800) == 0) - break; -# endif - out[0] = SWAB2(in[0]); - out[1] = SWAB2(in[1]); - out[2] = SWAB2(in[2]); - out[3] = SWAB2(in[3]); - in += 4; out += 4; - } -#endif - while (in < end) { - Py_UCS4 ch = *in++; -#if STRINGLIB_MAX_CHAR >= 0xd800 - if (ch < 0xd800) - *out++ = SWAB2((Py_UCS2)ch); - else if (ch < 0xe000) - /* reject surrogate characters (U+DC800-U+DFFF) */ - goto fail; -# if STRINGLIB_MAX_CHAR >= 0x10000 - else if (ch >= 0x10000) { - Py_UCS2 ch1 = Py_UNICODE_HIGH_SURROGATE(ch); - Py_UCS2 ch2 = Py_UNICODE_LOW_SURROGATE(ch); - out[0] = SWAB2(ch1); - out[1] = SWAB2(ch2); - out += 2; - } -# endif - else -#endif - *out++ = SWAB2((Py_UCS2)ch); - } - } - *outptr = out; - return len; -#if STRINGLIB_MAX_CHAR >= 0xd800 - fail: -#endif - *outptr = out; - return len - (end - in + 1); -} -#endif - -#undef SWAB2 - #if STRINGLIB_MAX_CHAR >= 0x80 Py_LOCAL_INLINE(Py_ssize_t) STRINGLIB(utf16_encode)(const STRINGLIB_CHAR *in,