summaryrefslogtreecommitdiffstats
path: root/Include/unicodeobject.h
diff options
context:
space:
mode:
authorVictor Stinner <victor.stinner@haypocalc.com>2012-01-03 23:33:50 (GMT)
committerVictor Stinner <victor.stinner@haypocalc.com>2012-01-03 23:33:50 (GMT)
commit3fe553160c785f76ca908500a7531fceb2176203 (patch)
tree92adb3edbe5e192bc48bf8b69a4c234f4d1f27b6 /Include/unicodeobject.h
parent332503db07ab5f8c2dea301a7ec9b8f7d4f1152f (diff)
downloadcpython-3fe553160c785f76ca908500a7531fceb2176203.zip
cpython-3fe553160c785f76ca908500a7531fceb2176203.tar.gz
cpython-3fe553160c785f76ca908500a7531fceb2176203.tar.bz2
Add a new PyUnicode_Fill() function
It is faster than the unicode_fill() function which was implemented in formatter_unicode.c.
Diffstat (limited to 'Include/unicodeobject.h')
-rw-r--r--Include/unicodeobject.h23
1 files changed, 20 insertions, 3 deletions
diff --git a/Include/unicodeobject.h b/Include/unicodeobject.h
index dfd594e..6255dc3 100644
--- a/Include/unicodeobject.h
+++ b/Include/unicodeobject.h
@@ -623,11 +623,11 @@ PyAPI_FUNC(PyObject*) _PyUnicode_Copy(
#endif
/* Copy character from one unicode object into another, this function performs
- character conversion when necessary and falls back to memcpy if possible.
+ character conversion when necessary and falls back to memcpy() if possible.
- Fail if to is too small (smaller than how_many or smaller than
+ Fail if to is too small (smaller than *how_many* or smaller than
len(from)-from_start), or if kind(from[from_start:from_start+how_many]) >
- kind(to), or if to has more than 1 reference.
+ kind(to), or if *to* has more than 1 reference.
Return the number of written character, or return -1 and raise an exception
on error.
@@ -650,6 +650,23 @@ PyAPI_FUNC(Py_ssize_t) PyUnicode_CopyCharacters(
);
#endif
+/* Fill a string with a character: write fill_char into
+ unicode[start:start+length].
+
+ Fail if fill_char is bigger than the string maximum character, or if the
+ string has more than 1 reference.
+
+ Return the number of written character, or return -1 and raise an exception
+ on error. */
+#ifndef Py_LIMITED_API
+PyAPI_FUNC(Py_ssize_t) PyUnicode_Fill(
+ PyObject *unicode,
+ Py_ssize_t start,
+ Py_ssize_t length,
+ Py_UCS4 fill_char
+ );
+#endif
+
/* Create a Unicode Object from the Py_UNICODE buffer u of the given
size.