aboutsummaryrefslogtreecommitdiffstats
path: root/contrib/tools/cython/Cython/Utility/StringTools.c
diff options
context:
space:
mode:
authorshadchin <shadchin@yandex-team.ru>2022-02-10 16:44:39 +0300
committerDaniil Cherednik <dcherednik@yandex-team.ru>2022-02-10 16:44:39 +0300
commite9656aae26e0358d5378e5b63dcac5c8dbe0e4d0 (patch)
tree64175d5cadab313b3e7039ebaa06c5bc3295e274 /contrib/tools/cython/Cython/Utility/StringTools.c
parent2598ef1d0aee359b4b6d5fdd1758916d5907d04f (diff)
downloadydb-e9656aae26e0358d5378e5b63dcac5c8dbe0e4d0.tar.gz
Restoring authorship annotation for <shadchin@yandex-team.ru>. Commit 2 of 2.
Diffstat (limited to 'contrib/tools/cython/Cython/Utility/StringTools.c')
-rw-r--r--contrib/tools/cython/Cython/Utility/StringTools.c88
1 files changed, 44 insertions, 44 deletions
diff --git a/contrib/tools/cython/Cython/Utility/StringTools.c b/contrib/tools/cython/Cython/Utility/StringTools.c
index 205bb7204f..2fdae812a0 100644
--- a/contrib/tools/cython/Cython/Utility/StringTools.c
+++ b/contrib/tools/cython/Cython/Utility/StringTools.c
@@ -66,19 +66,19 @@ static CYTHON_INLINE int __Pyx_UnicodeContainsUCS4(PyObject* unicode, Py_UCS4 ch
//////////////////// PyUCS4InUnicode ////////////////////
-#if PY_VERSION_HEX < 0x03090000 || (defined(PyUnicode_WCHAR_KIND) && defined(PyUnicode_AS_UNICODE))
-
-#if PY_VERSION_HEX < 0x03090000
-#define __Pyx_PyUnicode_AS_UNICODE(op) PyUnicode_AS_UNICODE(op)
-#define __Pyx_PyUnicode_GET_SIZE(op) PyUnicode_GET_SIZE(op)
-#else
-// Avoid calling deprecated C-API functions in Py3.9+ that PEP-623 schedules for removal in Py3.12.
-// https://www.python.org/dev/peps/pep-0623/
-#define __Pyx_PyUnicode_AS_UNICODE(op) (((PyASCIIObject *)(op))->wstr)
-#define __Pyx_PyUnicode_GET_SIZE(op) ((PyCompactUnicodeObject *)(op))->wstr_length
-#endif
-
-#if !defined(Py_UNICODE_SIZE) || Py_UNICODE_SIZE == 2
+#if PY_VERSION_HEX < 0x03090000 || (defined(PyUnicode_WCHAR_KIND) && defined(PyUnicode_AS_UNICODE))
+
+#if PY_VERSION_HEX < 0x03090000
+#define __Pyx_PyUnicode_AS_UNICODE(op) PyUnicode_AS_UNICODE(op)
+#define __Pyx_PyUnicode_GET_SIZE(op) PyUnicode_GET_SIZE(op)
+#else
+// Avoid calling deprecated C-API functions in Py3.9+ that PEP-623 schedules for removal in Py3.12.
+// https://www.python.org/dev/peps/pep-0623/
+#define __Pyx_PyUnicode_AS_UNICODE(op) (((PyASCIIObject *)(op))->wstr)
+#define __Pyx_PyUnicode_GET_SIZE(op) ((PyCompactUnicodeObject *)(op))->wstr_length
+#endif
+
+#if !defined(Py_UNICODE_SIZE) || Py_UNICODE_SIZE == 2
static int __Pyx_PyUnicodeBufferContainsUCS4_SP(Py_UNICODE* buffer, Py_ssize_t length, Py_UCS4 character) {
/* handle surrogate pairs for Py_UNICODE buffers in 16bit Unicode builds */
Py_UNICODE high_val, low_val;
@@ -90,7 +90,7 @@ static int __Pyx_PyUnicodeBufferContainsUCS4_SP(Py_UNICODE* buffer, Py_ssize_t l
}
return 0;
}
-#endif
+#endif
static int __Pyx_PyUnicodeBufferContainsUCS4_BMP(Py_UNICODE* buffer, Py_ssize_t length, Py_UCS4 character) {
Py_UNICODE uchar;
@@ -101,15 +101,15 @@ static int __Pyx_PyUnicodeBufferContainsUCS4_BMP(Py_UNICODE* buffer, Py_ssize_t
}
return 0;
}
-#endif
+#endif
static CYTHON_INLINE int __Pyx_UnicodeContainsUCS4(PyObject* unicode, Py_UCS4 character) {
#if CYTHON_PEP393_ENABLED
const int kind = PyUnicode_KIND(unicode);
- #ifdef PyUnicode_WCHAR_KIND
- if (likely(kind != PyUnicode_WCHAR_KIND))
- #endif
- {
+ #ifdef PyUnicode_WCHAR_KIND
+ if (likely(kind != PyUnicode_WCHAR_KIND))
+ #endif
+ {
Py_ssize_t i;
const void* udata = PyUnicode_DATA(unicode);
const Py_ssize_t length = PyUnicode_GET_LENGTH(unicode);
@@ -118,29 +118,29 @@ static CYTHON_INLINE int __Pyx_UnicodeContainsUCS4(PyObject* unicode, Py_UCS4 ch
}
return 0;
}
-#elif PY_VERSION_HEX >= 0x03090000
- #error Cannot use "UChar in Unicode" in Python 3.9 without PEP-393 unicode strings.
-#elif !defined(PyUnicode_AS_UNICODE)
- #error Cannot use "UChar in Unicode" in Python < 3.9 without Py_UNICODE support.
+#elif PY_VERSION_HEX >= 0x03090000
+ #error Cannot use "UChar in Unicode" in Python 3.9 without PEP-393 unicode strings.
+#elif !defined(PyUnicode_AS_UNICODE)
+ #error Cannot use "UChar in Unicode" in Python < 3.9 without Py_UNICODE support.
#endif
-
-#if PY_VERSION_HEX < 0x03090000 || (defined(PyUnicode_WCHAR_KIND) && defined(PyUnicode_AS_UNICODE))
-#if !defined(Py_UNICODE_SIZE) || Py_UNICODE_SIZE == 2
- if ((sizeof(Py_UNICODE) == 2) && unlikely(character > 65535)) {
+
+#if PY_VERSION_HEX < 0x03090000 || (defined(PyUnicode_WCHAR_KIND) && defined(PyUnicode_AS_UNICODE))
+#if !defined(Py_UNICODE_SIZE) || Py_UNICODE_SIZE == 2
+ if ((sizeof(Py_UNICODE) == 2) && unlikely(character > 65535)) {
return __Pyx_PyUnicodeBufferContainsUCS4_SP(
- __Pyx_PyUnicode_AS_UNICODE(unicode),
- __Pyx_PyUnicode_GET_SIZE(unicode),
+ __Pyx_PyUnicode_AS_UNICODE(unicode),
+ __Pyx_PyUnicode_GET_SIZE(unicode),
character);
- } else
-#endif
- {
+ } else
+#endif
+ {
return __Pyx_PyUnicodeBufferContainsUCS4_BMP(
- __Pyx_PyUnicode_AS_UNICODE(unicode),
- __Pyx_PyUnicode_GET_SIZE(unicode),
+ __Pyx_PyUnicode_AS_UNICODE(unicode),
+ __Pyx_PyUnicode_GET_SIZE(unicode),
character);
}
-#endif
+#endif
}
@@ -471,7 +471,7 @@ static CYTHON_INLINE PyObject* __Pyx_decode_c_string(
/////////////// decode_c_string ///////////////
//@requires: IncludeStringH
//@requires: decode_c_string_utf16
-//@substitute: naming
+//@substitute: naming
/* duplicate code to avoid calling strlen() if start >= 0 and stop >= 0 */
static CYTHON_INLINE PyObject* __Pyx_decode_c_string(
@@ -495,8 +495,8 @@ static CYTHON_INLINE PyObject* __Pyx_decode_c_string(
if (stop < 0)
stop += length;
}
- if (unlikely(stop <= start))
- return __Pyx_NewRef($empty_unicode);
+ if (unlikely(stop <= start))
+ return __Pyx_NewRef($empty_unicode);
length = stop - start;
cstring += start;
if (decode_func) {
@@ -515,7 +515,7 @@ static CYTHON_INLINE PyObject* __Pyx_decode_c_bytes(
/////////////// decode_c_bytes ///////////////
//@requires: decode_c_string_utf16
-//@substitute: naming
+//@substitute: naming
static CYTHON_INLINE PyObject* __Pyx_decode_c_bytes(
const char* cstring, Py_ssize_t length, Py_ssize_t start, Py_ssize_t stop,
@@ -532,8 +532,8 @@ static CYTHON_INLINE PyObject* __Pyx_decode_c_bytes(
}
if (stop > length)
stop = length;
- if (unlikely(stop <= start))
- return __Pyx_NewRef($empty_unicode);
+ if (unlikely(stop <= start))
+ return __Pyx_NewRef($empty_unicode);
length = stop - start;
cstring += start;
if (decode_func) {
@@ -573,7 +573,7 @@ static CYTHON_INLINE PyObject* __Pyx_PyUnicode_Substring(
PyObject* text, Py_ssize_t start, Py_ssize_t stop);
/////////////// PyUnicode_Substring ///////////////
-//@substitute: naming
+//@substitute: naming
static CYTHON_INLINE PyObject* __Pyx_PyUnicode_Substring(
PyObject* text, Py_ssize_t start, Py_ssize_t stop) {
@@ -589,8 +589,8 @@ static CYTHON_INLINE PyObject* __Pyx_PyUnicode_Substring(
stop += length;
else if (stop > length)
stop = length;
- if (stop <= start)
- return __Pyx_NewRef($empty_unicode);
+ if (stop <= start)
+ return __Pyx_NewRef($empty_unicode);
#if CYTHON_PEP393_ENABLED
return PyUnicode_FromKindAndData(PyUnicode_KIND(text),
PyUnicode_1BYTE_DATA(text) + start*PyUnicode_KIND(text), stop-start);