@@ -9576,6 +9576,34 @@ do_lower(int kind, void *data, Py_ssize_t length, Py_UCS4 *res, Py_UCS4 *maxchar
9576
9576
return do_upper_or_lower (kind , data , length , res , maxchar , 1 );
9577
9577
}
9578
9578
9579
+ static Py_ssize_t
9580
+ do_title (int kind , void * data , Py_ssize_t length , Py_UCS4 * res , Py_UCS4 * maxchar )
9581
+ {
9582
+ Py_ssize_t i , k = 0 ;
9583
+ int previous_is_cased ;
9584
+
9585
+ previous_is_cased = 0 ;
9586
+ for (i = 0 ; i < length ; i ++ ) {
9587
+ const Py_UCS4 c = PyUnicode_READ (kind , data , i );
9588
+ Py_UCS4 mapped [3 ];
9589
+ int n_res , j ;
9590
+
9591
+ if (previous_is_cased )
9592
+ n_res = lower_ucs4 (kind , data , length , i , c , mapped );
9593
+ else
9594
+ n_res = _PyUnicode_ToTitleFull (c , mapped );
9595
+
9596
+ for (j = 0 ; j < n_res ; j ++ ) {
9597
+ if (mapped [j ] > * maxchar )
9598
+ * maxchar = mapped [j ];
9599
+ res [k ++ ] = mapped [j ];
9600
+ }
9601
+
9602
+ previous_is_cased = _PyUnicode_IsCased (c );
9603
+ }
9604
+ return k ;
9605
+ }
9606
+
9579
9607
static PyObject *
9580
9608
case_operation (PyObject * self ,
9581
9609
Py_ssize_t (* perform )(int , void * , Py_ssize_t , Py_UCS4 * , Py_UCS4 * ))
@@ -9621,34 +9649,6 @@ case_operation(PyObject *self,
9621
9649
return res ;
9622
9650
}
9623
9651
9624
- static Py_ssize_t
9625
- do_title (int kind , void * data , Py_ssize_t length , Py_UCS4 * res , Py_UCS4 * maxchar )
9626
- {
9627
- Py_ssize_t i , k = 0 ;
9628
- int previous_is_cased ;
9629
-
9630
- previous_is_cased = 0 ;
9631
- for (i = 0 ; i < length ; i ++ ) {
9632
- const Py_UCS4 c = PyUnicode_READ (kind , data , i );
9633
- Py_UCS4 mapped [3 ];
9634
- int n_res , j ;
9635
-
9636
- if (previous_is_cased )
9637
- n_res = lower_ucs4 (kind , data , length , i , c , mapped );
9638
- else
9639
- n_res = _PyUnicode_ToTitleFull (c , mapped );
9640
-
9641
- for (j = 0 ; j < n_res ; j ++ ) {
9642
- if (mapped [j ] > * maxchar )
9643
- * maxchar = mapped [j ];
9644
- res [k ++ ] = mapped [j ];
9645
- }
9646
-
9647
- previous_is_cased = _PyUnicode_IsCased (c );
9648
- }
9649
- return k ;
9650
- }
9651
-
9652
9652
PyObject *
9653
9653
PyUnicode_Join (PyObject * separator , PyObject * seq )
9654
9654
{
0 commit comments