@@ -13207,30 +13207,30 @@ typedef struct {
1320713207 enum PyUnicode_Kind kind ;
1320813208 Py_UCS4 maxchar ;
1320913209 Py_ssize_t pos ;
13210- } unicode_writer_t ;
13210+ } _PyUnicodeWriter ;
1321113211
1321213212Py_LOCAL_INLINE (void )
13213- unicode_writer_update ( unicode_writer_t * writer )
13213+ _PyUnicodeWriter_Update ( _PyUnicodeWriter * writer )
1321413214{
1321513215 writer -> maxchar = PyUnicode_MAX_CHAR_VALUE (writer -> buffer );
1321613216 writer -> data = PyUnicode_DATA (writer -> buffer );
1321713217 writer -> kind = PyUnicode_KIND (writer -> buffer );
1321813218}
1321913219
1322013220Py_LOCAL (int )
13221- unicode_writer_init ( unicode_writer_t * writer ,
13221+ _PyUnicodeWriter_Init ( _PyUnicodeWriter * writer ,
1322213222 Py_ssize_t length , Py_UCS4 maxchar )
1322313223{
1322413224 writer -> pos = 0 ;
1322513225 writer -> buffer = PyUnicode_New (length , maxchar );
1322613226 if (writer -> buffer == NULL )
1322713227 return -1 ;
13228- unicode_writer_update (writer );
13228+ _PyUnicodeWriter_Update (writer );
1322913229 return 0 ;
1323013230}
1323113231
1323213232Py_LOCAL_INLINE (int )
13233- unicode_writer_prepare ( unicode_writer_t * writer ,
13233+ _PyUnicodeWriter_Prepare ( _PyUnicodeWriter * writer ,
1323413234 Py_ssize_t length , Py_UCS4 maxchar )
1323513235{
1323613236 Py_ssize_t newlen ;
@@ -13262,18 +13262,18 @@ unicode_writer_prepare(unicode_writer_t *writer,
1326213262 return -1 ;
1326313263 }
1326413264 writer -> buffer = newbuffer ;
13265- unicode_writer_update (writer );
13265+ _PyUnicodeWriter_Update (writer );
1326613266 }
1326713267 else if (maxchar > writer -> maxchar ) {
1326813268 if (unicode_widen (& writer -> buffer , writer -> pos , maxchar ) < 0 )
1326913269 return -1 ;
13270- unicode_writer_update (writer );
13270+ _PyUnicodeWriter_Update (writer );
1327113271 }
1327213272 return 0 ;
1327313273}
1327413274
1327513275Py_LOCAL (PyObject * )
13276- unicode_writer_finish ( unicode_writer_t * writer )
13276+ _PyUnicodeWriter_Finish ( _PyUnicodeWriter * writer )
1327713277{
1327813278 if (PyUnicode_Resize (& writer -> buffer , writer -> pos ) < 0 ) {
1327913279 Py_DECREF (writer -> buffer );
@@ -13284,7 +13284,7 @@ unicode_writer_finish(unicode_writer_t *writer)
1328413284}
1328513285
1328613286Py_LOCAL (void )
13287- unicode_writer_dealloc ( unicode_writer_t * writer )
13287+ _PyUnicodeWriter_Dealloc ( _PyUnicodeWriter * writer )
1328813288{
1328913289 Py_CLEAR (writer -> buffer );
1329013290}
@@ -13749,7 +13749,7 @@ PyUnicode_Format(PyObject *format, PyObject *args)
1374913749 PyObject * uformat ;
1375013750 void * fmt ;
1375113751 enum PyUnicode_Kind kind , fmtkind ;
13752- unicode_writer_t writer ;
13752+ _PyUnicodeWriter writer ;
1375313753 Py_ssize_t sublen ;
1375413754 Py_UCS4 maxchar ;
1375513755
@@ -13768,7 +13768,7 @@ PyUnicode_Format(PyObject *format, PyObject *args)
1376813768 fmtcnt = PyUnicode_GET_LENGTH (uformat );
1376913769 fmtpos = 0 ;
1377013770
13771- if (unicode_writer_init (& writer , fmtcnt + 100 , 127 ) < 0 )
13771+ if (_PyUnicodeWriter_Init (& writer , fmtcnt + 100 , 127 ) < 0 )
1377213772 goto onError ;
1377313773
1377413774 if (PyTuple_Check (args )) {
@@ -13797,7 +13797,7 @@ PyUnicode_Format(PyObject *format, PyObject *args)
1379713797 sublen = fmtpos - nonfmtpos ;
1379813798 maxchar = _PyUnicode_FindMaxChar (uformat ,
1379913799 nonfmtpos , nonfmtpos + sublen );
13800- if (unicode_writer_prepare (& writer , sublen , maxchar ) == -1 )
13800+ if (_PyUnicodeWriter_Prepare (& writer , sublen , maxchar ) == -1 )
1380113801 goto onError ;
1380213802
1380313803 copy_characters (writer .buffer , writer .pos ,
@@ -13961,7 +13961,7 @@ PyUnicode_Format(PyObject *format, PyObject *args)
1396113961 }
1396213962
1396313963 if (c == '%' ) {
13964- if (unicode_writer_prepare (& writer , 1 , '%' ) == -1 )
13964+ if (_PyUnicodeWriter_Prepare (& writer , 1 , '%' ) == -1 )
1396513965 goto onError ;
1396613966 PyUnicode_WRITE (writer .kind , writer .data , writer .pos , '%' );
1396713967 writer .pos += 1 ;
@@ -14119,7 +14119,7 @@ PyUnicode_Format(PyObject *format, PyObject *args)
1411914119 if (sign && len == width )
1412014120 buflen ++ ;
1412114121
14122- if (unicode_writer_prepare (& writer , buflen , bufmaxchar ) == -1 )
14122+ if (_PyUnicodeWriter_Prepare (& writer , buflen , bufmaxchar ) == -1 )
1412314123 goto onError ;
1412414124
1412514125 /* Write characters */
@@ -14195,13 +14195,13 @@ PyUnicode_Format(PyObject *format, PyObject *args)
1419514195 Py_DECREF (uformat );
1419614196 Py_XDECREF (temp );
1419714197 Py_XDECREF (second );
14198- return unicode_writer_finish (& writer );
14198+ return _PyUnicodeWriter_Finish (& writer );
1419914199
1420014200 onError :
1420114201 Py_DECREF (uformat );
1420214202 Py_XDECREF (temp );
1420314203 Py_XDECREF (second );
14204- unicode_writer_dealloc (& writer );
14204+ _PyUnicodeWriter_Dealloc (& writer );
1420514205 if (args_owned ) {
1420614206 Py_DECREF (args );
1420714207 }
0 commit comments