[Python-checkins] cpython (merge 3.2 -> default): Merge 3.2: Fix PyUnicode_AsWideCharString() doc

victor.stinner python-checkins at python.org
Tue Sep 6 02:01:59 CEST 2011


http://hg.python.org/cpython/rev/218e297f72e1
changeset: 72299:218e297f72e1
parent: 72297:b1e03d10391e
parent: 72298:028423c89f8d
user: Victor Stinner <victor.stinner at haypocalc.com>
date: Tue Sep 06 02:01:29 2011 +0200
summary:
 Merge 3.2: Fix PyUnicode_AsWideCharString() doc
 - Fix PyUnicode_AsWideCharString() doc: size doesn't contain the null
 character
 - Fix spelling of the null character
files:
 Include/unicodeobject.h | 2 +-
 Objects/unicodeobject.c | 10 +++++-----
 2 files changed, 6 insertions(+), 6 deletions(-)
diff --git a/Include/unicodeobject.h b/Include/unicodeobject.h
--- a/Include/unicodeobject.h
+++ b/Include/unicodeobject.h
@@ -608,7 +608,7 @@
 
 /* Convert the Unicode object to a wide character string. The output string
 always ends with a nul character. If size is not NULL, write the number of
- wide characters (including the nul character) into *size.
+ wide characters (excluding the null character) into *size.
 
 Returns a buffer allocated by PyMem_Alloc() (use PyMem_Free() to free it)
 on success. On error, returns NULL, *size is undefined and raises a
diff --git a/Objects/unicodeobject.c b/Objects/unicodeobject.c
--- a/Objects/unicodeobject.c
+++ b/Objects/unicodeobject.c
@@ -1204,12 +1204,12 @@
 /* Helper function for PyUnicode_AsWideChar() and PyUnicode_AsWideCharString():
 convert a Unicode object to a wide character string.
 
- - If w is NULL: return the number of wide characters (including the nul
+ - If w is NULL: return the number of wide characters (including the null
 character) required to convert the unicode object. Ignore size argument.
 
- - Otherwise: return the number of wide characters (excluding the nul
+ - Otherwise: return the number of wide characters (excluding the null
 character) written into w. Write at most size wide characters (including
- the nul character). */
+ the null character). */
 static Py_ssize_t
 unicode_aswidechar(PyUnicodeObject *unicode,
 wchar_t *w,
@@ -1257,7 +1257,7 @@
 return w - worig;
 }
 else {
- nchar = 1; /* nul character at the end */
+ nchar = 1; /* null character at the end */
 while (u != uend) {
 if (0xD800 <= u[0] && u[0] <= 0xDBFF
 && 0xDC00 <= u[1] && u[1] <= 0xDFFF)
@@ -1295,7 +1295,7 @@
 return w - worig;
 }
 else {
- nchar = 1; /* nul character */
+ nchar = 1; /* null character */
 while (u != uend) {
 if (*u > 0xffff)
 nchar += 2;
-- 
Repository URL: http://hg.python.org/cpython


More information about the Python-checkins mailing list

AltStyle によって変換されたページ (->オリジナル) /