554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
|
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
|
-
+
-
|
int
Tcl_NumUtfChars(
register CONST char *src, /* The UTF-8 string to measure. */
int length) /* The length of the string in bytes, or -1
* for strlen(string). */
{
register int i;
register int i = 0;
/*
* The separate implementations are faster.
*
* Since this is a time-sensitive function, we also do the check for the
* single-byte char case specially.
*/
i = 0;
if (length < 0) {
while ((*src != '\0') && (i < INT_MAX)) {
src = TclUtfNext(src);
i++;
}
} else {
register const char *endPtr = src + length - TCL_UTF_MAX;
|