summaryrefslogtreecommitdiffstats
path: root/Include
diff options
context:
space:
mode:
authorVictor Stinner <victor.stinner@haypocalc.com>2010-09-01 23:43:53 (GMT)
committerVictor Stinner <victor.stinner@haypocalc.com>2010-09-01 23:43:53 (GMT)
commit71133ff36848e6dddc541d752ad86d9fbd65bfd4 (patch)
tree9cb23f97ed1fed9bd543e8c0213c362e344bd2a8 /Include
parentc4eb765fc1c1fb90c9de90917e167d2e0f907b8d (diff)
downloadcpython-71133ff36848e6dddc541d752ad86d9fbd65bfd4.zip
cpython-71133ff36848e6dddc541d752ad86d9fbd65bfd4.tar.gz
cpython-71133ff36848e6dddc541d752ad86d9fbd65bfd4.tar.bz2
Create PyUnicode_strdup() function
Diffstat (limited to 'Include')
-rw-r--r--Include/unicodeobject.h11
1 files changed, 10 insertions, 1 deletions
diff --git a/Include/unicodeobject.h b/Include/unicodeobject.h
index afef5d0..b6a7fca 100644
--- a/Include/unicodeobject.h
+++ b/Include/unicodeobject.h
@@ -220,6 +220,7 @@ typedef PY_UNICODE_TYPE Py_UNICODE;
# define _PyUnicode_AsDefaultEncodedString _PyUnicodeUCS2_AsDefaultEncodedString
# define _PyUnicode_Fini _PyUnicodeUCS2_Fini
# define _PyUnicode_Init _PyUnicodeUCS2_Init
+# define PyUnicode_strdup PyUnicodeUCS2_strdup
#else
@@ -302,7 +303,7 @@ typedef PY_UNICODE_TYPE Py_UNICODE;
# define _PyUnicode_AsDefaultEncodedString _PyUnicodeUCS4_AsDefaultEncodedString
# define _PyUnicode_Fini _PyUnicodeUCS4_Fini
# define _PyUnicode_Init _PyUnicodeUCS4_Init
-
+# define PyUnicode_strdup PyUnicodeUCS4_strdup
#endif
@@ -1602,6 +1603,14 @@ PyAPI_FUNC(Py_UNICODE*) Py_UNICODE_strrchr(
Py_UNICODE c
);
+/* Create a copy of a unicode string ending with a nul character. Return NULL
+ and raise a MemoryError exception on memory allocation failure, otherwise
+ return a new allocated buffer (use PyMem_Free() to free the buffer). */
+
+PyAPI_FUNC(Py_UNICODE*) PyUnicode_strdup(
+ PyObject *unicode
+ );
+
#ifdef __cplusplus
}
#endif