summaryrefslogtreecommitdiffstats
path: root/generic
diff options
context:
space:
mode:
authorjan.nijtmans <nijtmans@users.sourceforge.net>2024-03-20 20:09:29 (GMT)
committerjan.nijtmans <nijtmans@users.sourceforge.net>2024-03-20 20:09:29 (GMT)
commitab2ee17c917d4c1ac391bc15fe68a87e672f2f73 (patch)
tree7c4f63c41795347c14b781d88cec86b1ff8d310b /generic
parentdb2c4a21b2cc03076d2c22b74dea2662f5f35143 (diff)
parent30f26cff8be85483cb7c90b15ce9acc2f4607583 (diff)
downloadtcl-ab2ee17c917d4c1ac391bc15fe68a87e672f2f73.zip
tcl-ab2ee17c917d4c1ac391bc15fe68a87e672f2f73.tar.gz
tcl-ab2ee17c917d4c1ac391bc15fe68a87e672f2f73.tar.bz2
Fix [6811a00819]: lsearch performance degradation on Tcl 8.6.11 release (thanks, Sergey!)
Diffstat (limited to 'generic')
-rw-r--r--generic/tclBinary.c8
-rw-r--r--generic/tclCmdIL.c4
-rw-r--r--generic/tclCmdMZ.c8
-rw-r--r--generic/tclCompExpr.c4
-rw-r--r--generic/tclDisassemble.c2
-rw-r--r--generic/tclEncoding.c14
-rw-r--r--generic/tclParse.c4
-rw-r--r--generic/tclScan.c2
-rw-r--r--generic/tclStringObj.c2
-rw-r--r--generic/tclUtf.c19
-rw-r--r--generic/tclUtil.c30
11 files changed, 48 insertions, 49 deletions
diff --git a/generic/tclBinary.c b/generic/tclBinary.c
index 8be4b75..570f4d5 100644
--- a/generic/tclBinary.c
+++ b/generic/tclBinary.c
@@ -436,7 +436,7 @@ Tcl_GetBytesFromObj(
irPtr = TclFetchInternalRep(objPtr, &tclByteArrayType);
baPtr = GET_BYTEARRAY(irPtr);
nonbyte = TclUtfAtIndex(Tcl_GetString(objPtr), baPtr->bad);
- Tcl_UtfToUniChar(nonbyte, &ucs4);
+ TclUtfToUniChar(nonbyte, &ucs4);
Tcl_SetObjResult(interp, Tcl_ObjPrintf(
"expected byte sequence but character %d "
@@ -2654,7 +2654,7 @@ BinaryDecodeHex(
if (pure) {
ucs4 = c;
} else {
- Tcl_UtfToUniChar((const char *)(data - 1), &ucs4);
+ TclUtfToUniChar((const char *)(data - 1), &ucs4);
}
TclDecrRefCount(resultObj);
Tcl_SetObjResult(interp, Tcl_ObjPrintf(
@@ -3113,7 +3113,7 @@ BinaryDecodeUu(
if (pure) {
ucs4 = c;
} else {
- Tcl_UtfToUniChar((const char *)(data - 1), &ucs4);
+ TclUtfToUniChar((const char *)(data - 1), &ucs4);
}
Tcl_SetObjResult(interp, Tcl_ObjPrintf(
"invalid uuencode character \"%c\" (U+%06X) at position %d",
@@ -3288,7 +3288,7 @@ BinaryDecode64(
* of a multi-byte character. */
/* Safe because we know data is NUL-terminated */
- Tcl_UtfToUniChar((const char *)(data - 1), &ucs4);
+ TclUtfToUniChar((const char *)(data - 1), &ucs4);
}
Tcl_SetObjResult(interp, Tcl_ObjPrintf(
diff --git a/generic/tclCmdIL.c b/generic/tclCmdIL.c
index 116dbbf..de96267 100644
--- a/generic/tclCmdIL.c
+++ b/generic/tclCmdIL.c
@@ -5431,8 +5431,8 @@ DictionaryCompare(
*/
if ((*left != '\0') && (*right != '\0')) {
- left += Tcl_UtfToUniChar(left, &uniLeft);
- right += Tcl_UtfToUniChar(right, &uniRight);
+ left += TclUtfToUniChar(left, &uniLeft);
+ right += TclUtfToUniChar(right, &uniRight);
/*
* Convert both chars to lower for the comparison, because
diff --git a/generic/tclCmdMZ.c b/generic/tclCmdMZ.c
index c6176a6..1df9dd1 100644
--- a/generic/tclCmdMZ.c
+++ b/generic/tclCmdMZ.c
@@ -1222,7 +1222,7 @@ Tcl_SplitObjCmd(
Tcl_InitHashTable(&charReuseTable, TCL_ONE_WORD_KEYS);
for ( ; stringPtr < end; stringPtr += len) {
- len = Tcl_UtfToUniChar(stringPtr, &ch);
+ len = TclUtfToUniChar(stringPtr, &ch);
hPtr = Tcl_CreateHashEntry(&charReuseTable, INT2PTR(ch), &isNew);
if (isNew) {
TclNewStringObj(objPtr, stringPtr, len);
@@ -1268,9 +1268,9 @@ Tcl_SplitObjCmd(
splitEnd = splitChars + splitCharLen;
for (element = stringPtr; stringPtr < end; stringPtr += len) {
- len = Tcl_UtfToUniChar(stringPtr, &ch);
+ len = TclUtfToUniChar(stringPtr, &ch);
for (p = splitChars; p < splitEnd; p += splitLen) {
- splitLen = Tcl_UtfToUniChar(p, &splitChar);
+ splitLen = TclUtfToUniChar(p, &splitChar);
if (ch == splitChar) {
TclNewStringObj(objPtr, element, stringPtr - element);
Tcl_ListObjAppendElement(NULL, listPtr, objPtr);
@@ -1898,7 +1898,7 @@ StringIsCmd(
for (; string1 < end; string1 += length2, failat++) {
int ucs4;
- length2 = Tcl_UtfToUniChar(string1, &ucs4);
+ length2 = TclUtfToUniChar(string1, &ucs4);
if (!chcomp(ucs4)) {
result = 0;
break;
diff --git a/generic/tclCompExpr.c b/generic/tclCompExpr.c
index 187c25c..7761ddd 100644
--- a/generic/tclCompExpr.c
+++ b/generic/tclCompExpr.c
@@ -2146,13 +2146,13 @@ ParseLexeme(
if (!TclIsBareword(*start) || *start == '_') {
if (Tcl_UtfCharComplete(start, numBytes)) {
- scanned = Tcl_UtfToUniChar(start, &ch);
+ scanned = TclUtfToUniChar(start, &ch);
} else {
char utfBytes[8];
memcpy(utfBytes, start, numBytes);
utfBytes[numBytes] = '\0';
- scanned = Tcl_UtfToUniChar(utfBytes, &ch);
+ scanned = TclUtfToUniChar(utfBytes, &ch);
}
*lexemePtr = INVALID;
Tcl_DecrRefCount(literal);
diff --git a/generic/tclDisassemble.c b/generic/tclDisassemble.c
index 81bfa08..a096a85 100644
--- a/generic/tclDisassemble.c
+++ b/generic/tclDisassemble.c
@@ -875,7 +875,7 @@ PrintSourceToObj(
for (; (*p != '\0') && (i < maxChars); p+=len) {
int ucs4;
- len = Tcl_UtfToUniChar(p, &ucs4);
+ len = TclUtfToUniChar(p, &ucs4);
switch (ucs4) {
case '"':
Tcl_AppendToObj(appendObj, "\\\"", -1);
diff --git a/generic/tclEncoding.c b/generic/tclEncoding.c
index 34d51e1..39c6ee3 100644
--- a/generic/tclEncoding.c
+++ b/generic/tclEncoding.c
@@ -1639,7 +1639,7 @@ Tcl_UtfToExternalDStringEx(
Tcl_Size pos = TclNumUtfChars(srcStart, nBytesProcessed);
int ucs4;
char buf[TCL_INTEGER_SPACE];
- Tcl_UtfToUniChar(&srcStart[nBytesProcessed], &ucs4);
+ TclUtfToUniChar(&srcStart[nBytesProcessed], &ucs4);
snprintf(buf, sizeof(buf), "%" TCL_SIZE_MODIFIER "d", nBytesProcessed);
Tcl_SetObjResult(
interp,
@@ -2604,12 +2604,12 @@ UtfToUtfProc(
/* TCL_ENCODING_PROFILE_TCL8 */
char chbuf[2];
chbuf[0] = UCHAR(*src++); chbuf[1] = 0;
- Tcl_UtfToUniChar(chbuf, &ch);
+ TclUtfToUniChar(chbuf, &ch);
}
dst += Tcl_UniCharToUtf(ch, dst);
} else {
int low;
- size_t len = Tcl_UtfToUniChar(src, &ch);
+ size_t len = TclUtfToUniChar(src, &ch);
if (flags & ENCODING_INPUT) {
if (((len < 2) && (ch != 0)) || ((ch > 0xFFFF) && !(flags & ENCODING_UTF))) {
if (PROFILE_STRICT(profile)) {
@@ -2646,7 +2646,7 @@ UtfToUtfProc(
ch = UNICODE_REPLACE_CHAR;
} else {
low = ch;
- len = (src <= srcEnd - 3) ? Tcl_UtfToUniChar(src, &low) : 0;
+ len = (src <= srcEnd - 3) ? TclUtfToUniChar(src, &low) : 0;
if ((!LOW_SURROGATE(low)) || (ch & 0x400)) {
@@ -2906,7 +2906,7 @@ UtfToUtf32Proc(
result = TCL_CONVERT_NOSPACE;
break;
}
- len = Tcl_UtfToUniChar(src, &ch);
+ len = TclUtfToUniChar(src, &ch);
if (SURROGATE(ch)) {
if (PROFILE_STRICT(flags)) {
result = TCL_CONVERT_UNKNOWN;
@@ -3184,7 +3184,7 @@ UtfToUtf16Proc(
result = TCL_CONVERT_NOSPACE;
break;
}
- len = Tcl_UtfToUniChar(src, &ch);
+ len = TclUtfToUniChar(src, &ch);
if (SURROGATE(ch)) {
if (PROFILE_STRICT(flags)) {
result = TCL_CONVERT_UNKNOWN;
@@ -3431,7 +3431,7 @@ TableToUtfProc(
} else {
char chbuf[2];
chbuf[0] = byte; chbuf[1] = 0;
- Tcl_UtfToUniChar(chbuf, &ch);
+ TclUtfToUniChar(chbuf, &ch);
}
}
diff --git a/generic/tclParse.c b/generic/tclParse.c
index aab69f3..281eee5 100644
--- a/generic/tclParse.c
+++ b/generic/tclParse.c
@@ -936,13 +936,13 @@ TclParseBackslash(
*/
if (Tcl_UtfCharComplete(p, numBytes - 1)) {
- count = Tcl_UtfToUniChar(p, &unichar) + 1; /* +1 for '\' */
+ count = TclUtfToUniChar(p, &unichar) + 1; /* +1 for '\' */
} else {
char utfBytes[8];
memcpy(utfBytes, p, numBytes - 1);
utfBytes[numBytes - 1] = '\0';
- count = Tcl_UtfToUniChar(utfBytes, &unichar) + 1;
+ count = TclUtfToUniChar(utfBytes, &unichar) + 1;
}
result = unichar;
break;
diff --git a/generic/tclScan.c b/generic/tclScan.c
index 4c141ab..d2dcc70 100644
--- a/generic/tclScan.c
+++ b/generic/tclScan.c
@@ -879,7 +879,7 @@ Tcl_ScanObjCmd(
* Scan a single Unicode character.
*/
- offset = Tcl_UtfToUniChar(string, &i);
+ offset = TclUtfToUniChar(string, &i);
string += offset;
if (!(flags & SCAN_SUPPRESS)) {
TclNewIntObj(objPtr, i);
diff --git a/generic/tclStringObj.c b/generic/tclStringObj.c
index bcab176..5ec026f 100644
--- a/generic/tclStringObj.c
+++ b/generic/tclStringObj.c
@@ -4383,7 +4383,7 @@ TclStringReverse(
* skip calling Tcl_UtfCharComplete() here.
*/
- int bytesInChar = Tcl_UtfToUniChar(from, &chw);
+ int bytesInChar = TclUtfToUniChar(from, &chw);
ReverseBytes((unsigned char *)to, (unsigned char *)from,
bytesInChar);
diff --git a/generic/tclUtf.c b/generic/tclUtf.c
index c685733..2fa0e80 100644
--- a/generic/tclUtf.c
+++ b/generic/tclUtf.c
@@ -443,7 +443,6 @@ static const unsigned short cp1252[32] = {
0x2DC, 0x2122, 0x0161, 0x203A, 0x0153, 0x9D, 0x017E, 0x0178
};
-#undef Tcl_UtfToUniChar
Tcl_Size
Tcl_UtfToUniChar(
const char *src, /* The UTF-8 string. */
@@ -685,11 +684,11 @@ Tcl_UtfToUniCharDString(
endPtr = src + length;
optPtr = endPtr - 4;
while (p <= optPtr) {
- p += Tcl_UtfToUniChar(p, &ch);
+ p += TclUtfToUniChar(p, &ch);
*w++ = ch;
}
while ((p < endPtr) && Tcl_UtfCharComplete(p, endPtr-p)) {
- p += Tcl_UtfToUniChar(p, &ch);
+ p += TclUtfToUniChar(p, &ch);
*w++ = ch;
}
while (p < endPtr) {
@@ -937,7 +936,7 @@ Tcl_UtfFindFirst(
int ch) /* The Unicode character to search for. */
{
while (1) {
- int find, len = Tcl_UtfToUniChar(src, &find);
+ int find, len = TclUtfToUniChar(src, &find);
if (find == ch) {
return src;
@@ -976,7 +975,7 @@ Tcl_UtfFindLast(
const char *last = NULL;
while (1) {
- int find, len = Tcl_UtfToUniChar(src, &find);
+ int find, len = TclUtfToUniChar(src, &find);
if (find == ch) {
last = src;
@@ -1203,7 +1202,7 @@ Tcl_UniCharAtIndex(
/* Index points at character following high Surrogate */
return -1;
}
- Tcl_UtfToUniChar(src, &i);
+ TclUtfToUniChar(src, &i);
return i;
}
@@ -1344,7 +1343,7 @@ Tcl_UtfToUpper(
src = dst = str;
while (*src) {
- len = Tcl_UtfToUniChar(src, &ch);
+ len = TclUtfToUniChar(src, &ch);
upChar = Tcl_UniCharToUpper(ch);
/*
@@ -1397,7 +1396,7 @@ Tcl_UtfToLower(
src = dst = str;
while (*src) {
- len = Tcl_UtfToUniChar(src, &ch);
+ len = TclUtfToUniChar(src, &ch);
lowChar = Tcl_UniCharToLower(ch);
/*
@@ -1453,7 +1452,7 @@ Tcl_UtfToTitle(
src = dst = str;
if (*src) {
- len = Tcl_UtfToUniChar(src, &ch);
+ len = TclUtfToUniChar(src, &ch);
titleChar = Tcl_UniCharToTitle(ch);
if ((len < TclUtfCount(titleChar)) || ((titleChar & ~0x7FF) == 0xD800)) {
@@ -1465,7 +1464,7 @@ Tcl_UtfToTitle(
src += len;
}
while (*src) {
- len = Tcl_UtfToUniChar(src, &ch);
+ len = TclUtfToUniChar(src, &ch);
lowChar = ch;
/* Special exception for Georgian Asomtavruli chars, no titlecase. */
if ((unsigned)(lowChar - 0x1C90) >= 0x30) {
diff --git a/generic/tclUtil.c b/generic/tclUtil.c
index 25f84e4..2219c84 100644
--- a/generic/tclUtil.c
+++ b/generic/tclUtil.c
@@ -1717,7 +1717,7 @@ TclTrimRight(
pp = Tcl_UtfPrev(p, bytes);
do {
pp += pInc;
- pInc = Tcl_UtfToUniChar(pp, &ch1);
+ pInc = TclUtfToUniChar(pp, &ch1);
} while (pp + pInc < p);
/*
@@ -1725,7 +1725,7 @@ TclTrimRight(
*/
do {
- pInc = Tcl_UtfToUniChar(q, &ch2);
+ pInc = TclUtfToUniChar(q, &ch2);
if (ch1 == ch2) {
break;
@@ -1790,7 +1790,7 @@ TclTrimLeft(
*/
do {
- Tcl_Size pInc = Tcl_UtfToUniChar(p, &ch1);
+ Tcl_Size pInc = TclUtfToUniChar(p, &ch1);
const char *q = trim;
Tcl_Size bytesLeft = numTrim;
@@ -1799,7 +1799,7 @@ TclTrimLeft(
*/
do {
- Tcl_Size qInc = Tcl_UtfToUniChar(q, &ch2);
+ Tcl_Size qInc = TclUtfToUniChar(q, &ch2);
if (ch1 == ch2) {
break;
@@ -1866,7 +1866,7 @@ TclTrim(
if (numBytes > 0) {
int ch;
const char *first = bytes + trimLeft;
- bytes += Tcl_UtfToUniChar(first, &ch);
+ bytes += TclUtfToUniChar(first, &ch);
numBytes -= (bytes - first);
if (numBytes > 0) {
@@ -2221,7 +2221,7 @@ Tcl_StringCaseMatch(
ch2 = (int)
(nocase ? tolower(UCHAR(*pattern)) : UCHAR(*pattern));
} else {
- Tcl_UtfToUniChar(pattern, &ch2);
+ TclUtfToUniChar(pattern, &ch2);
if (nocase) {
ch2 = Tcl_UniCharToLower(ch2);
}
@@ -2237,7 +2237,7 @@ Tcl_StringCaseMatch(
if ((p != '[') && (p != '?') && (p != '\\')) {
if (nocase) {
while (*str) {
- charLen = Tcl_UtfToUniChar(str, &ch1);
+ charLen = TclUtfToUniChar(str, &ch1);
if (ch2==ch1 || ch2==Tcl_UniCharToLower(ch1)) {
break;
}
@@ -2251,7 +2251,7 @@ Tcl_StringCaseMatch(
*/
while (*str) {
- charLen = Tcl_UtfToUniChar(str, &ch1);
+ charLen = TclUtfToUniChar(str, &ch1);
if (ch2 == ch1) {
break;
}
@@ -2265,7 +2265,7 @@ Tcl_StringCaseMatch(
if (*str == '\0') {
return 0;
}
- str += Tcl_UtfToUniChar(str, &ch1);
+ str += TclUtfToUniChar(str, &ch1);
}
}
@@ -2276,7 +2276,7 @@ Tcl_StringCaseMatch(
if (p == '?') {
pattern++;
- str += Tcl_UtfToUniChar(str, &ch1);
+ str += TclUtfToUniChar(str, &ch1);
continue;
}
@@ -2295,7 +2295,7 @@ Tcl_StringCaseMatch(
(nocase ? tolower(UCHAR(*str)) : UCHAR(*str));
str++;
} else {
- str += Tcl_UtfToUniChar(str, &ch1);
+ str += TclUtfToUniChar(str, &ch1);
if (nocase) {
ch1 = Tcl_UniCharToLower(ch1);
}
@@ -2309,7 +2309,7 @@ Tcl_StringCaseMatch(
? tolower(UCHAR(*pattern)) : UCHAR(*pattern));
pattern++;
} else {
- pattern += Tcl_UtfToUniChar(pattern, &startChar);
+ pattern += TclUtfToUniChar(pattern, &startChar);
if (nocase) {
startChar = Tcl_UniCharToLower(startChar);
}
@@ -2324,7 +2324,7 @@ Tcl_StringCaseMatch(
? tolower(UCHAR(*pattern)) : UCHAR(*pattern));
pattern++;
} else {
- pattern += Tcl_UtfToUniChar(pattern, &endChar);
+ pattern += TclUtfToUniChar(pattern, &endChar);
if (nocase) {
endChar = Tcl_UniCharToLower(endChar);
}
@@ -2372,8 +2372,8 @@ Tcl_StringCaseMatch(
* each string match.
*/
- str += Tcl_UtfToUniChar(str, &ch1);
- pattern += Tcl_UtfToUniChar(pattern, &ch2);
+ str += TclUtfToUniChar(str, &ch1);
+ pattern += TclUtfToUniChar(pattern, &ch2);
if (nocase) {
if (Tcl_UniCharToLower(ch1) != Tcl_UniCharToLower(ch2)) {
return 0;