comparison Objects/unicodeobject.c @ 73637:71cf0ea0b341

Remove the two ugly and unused WRITE_ASCII_OR_WSTR and WRITE_WSTR macros
author Victor Stinner <victor.stinner@haypocalc.com>
date Sun, 20 Nov 2011 18:41:31 +0100
parents 99e2ccd351c0
children 26af48f65ef3
comparison
equal deleted inserted replaced
73636:99e2ccd351c0 73637:71cf0ea0b341
5587 } 5587 }
5588 } 5588 }
5589 return length; 5589 return length;
5590 } 5590 }
5591 5591
5592 /* Similar to PyUnicode_WRITE but either write into wstr field
5593 or treat string as ASCII. */
5594 #define WRITE_ASCII_OR_WSTR(kind, buf, index, value) \
5595 do { \
5596 if ((kind) != PyUnicode_WCHAR_KIND) \
5597 ((unsigned char *)(buf))[(index)] = (unsigned char)(value); \
5598 else \
5599 ((Py_UNICODE *)(buf))[(index)] = (Py_UNICODE)(value); \
5600 } while (0)
5601
5602 #define WRITE_WSTR(buf, index, value) \
5603 assert(kind == PyUnicode_WCHAR_KIND), \
5604 ((Py_UNICODE *)(buf))[(index)] = (Py_UNICODE)(value)
5605
5606
5607 static _PyUnicode_Name_CAPI *ucnhash_CAPI = NULL; 5592 static _PyUnicode_Name_CAPI *ucnhash_CAPI = NULL;
5608 5593
5609 PyObject * 5594 PyObject *
5610 PyUnicode_DecodeUnicodeEscape(const char *s, 5595 PyUnicode_DecodeUnicodeEscape(const char *s,
5611 Py_ssize_t size, 5596 Py_ssize_t size,
5870 Py_XDECREF(v); 5855 Py_XDECREF(v);
5871 Py_XDECREF(errorHandler); 5856 Py_XDECREF(errorHandler);
5872 Py_XDECREF(exc); 5857 Py_XDECREF(exc);
5873 return NULL; 5858 return NULL;
5874 } 5859 }
5875
5876 #undef WRITE_ASCII_OR_WSTR
5877 #undef WRITE_WSTR
5878 5860
5879 /* Return a Unicode-Escape string version of the Unicode object. 5861 /* Return a Unicode-Escape string version of the Unicode object.
5880 5862
5881 If quotes is true, the string is enclosed in u"" or u'' quotes as 5863 If quotes is true, the string is enclosed in u"" or u'' quotes as
5882 appropriate. 5864 appropriate.