]> git.ipfire.org Git - thirdparty/Python/cpython.git/commitdiff
Fix PyUnicode_AsWideCharString() doc: size doesn't contain the null character
authorVictor Stinner <victor.stinner@haypocalc.com>
Tue, 6 Sep 2011 00:00:05 +0000 (02:00 +0200)
committerVictor Stinner <victor.stinner@haypocalc.com>
Tue, 6 Sep 2011 00:00:05 +0000 (02:00 +0200)
Fix also spelling of the null character.

Include/unicodeobject.h
Objects/unicodeobject.c

index 4d2a8e4d63f6bfdd2347cae383fe71788b59b5f8..477f526637bb74ae71450e93c4a5bf7b41d9a67b 100644 (file)
@@ -595,7 +595,7 @@ PyAPI_FUNC(Py_ssize_t) PyUnicode_AsWideChar(
 
 /* 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
index 8567a9f2db14a2d0c78413df9eea88dd19703952..7316abfc9c350c60ae9e34a4a288315592720708 100644 (file)
@@ -1187,12 +1187,12 @@ PyUnicode_FromFormat(const char *format, ...)
 /* 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,
@@ -1240,7 +1240,7 @@ unicode_aswidechar(PyUnicodeObject *unicode,
         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)
@@ -1278,7 +1278,7 @@ unicode_aswidechar(PyUnicodeObject *unicode,
         return w - worig;
     }
     else {
-        nchar = 1; /* nul character */
+        nchar = 1; /* null character */
         while (u != uend) {
             if (*u > 0xffff)
                 nchar += 2;