Author: Armin Rigo <[email protected]>
Branch: 
Changeset: r2986:54a7350ed586
Date: 2017-06-19 12:26 +0200
http://bitbucket.org/cffi/cffi/changeset/54a7350ed586/

Log:    Probable improvement

diff --git a/c/wchar_helper_3.h b/c/wchar_helper_3.h
--- a/c/wchar_helper_3.h
+++ b/c/wchar_helper_3.h
@@ -143,13 +143,7 @@
                                   cffi_char32_t *result,
                                   Py_ssize_t resultlen)
 {
-    Py_ssize_t len = PyUnicode_GET_LENGTH(unicode);
-    unsigned int kind = PyUnicode_KIND(unicode);
-    void *data = PyUnicode_DATA(unicode);
-    Py_ssize_t i;
-
-    for (i = 0; i < len; i++)
-        result[i] = PyUnicode_READ(kind, data, i);
-
+    if (PyUnicode_AsUCS4(unicode, (Py_UCS4 *)result, resultlen, 0) == NULL)
+        return -1;
     return 0;
 }
_______________________________________________
pypy-commit mailing list
[email protected]
https://mail.python.org/mailman/listinfo/pypy-commit

Reply via email to