summaryrefslogtreecommitdiffstats
path: root/generic/tclStringObj.c
diff options
context:
space:
mode:
Diffstat (limited to 'generic/tclStringObj.c')
-rw-r--r--generic/tclStringObj.c70
1 files changed, 36 insertions, 34 deletions
diff --git a/generic/tclStringObj.c b/generic/tclStringObj.c
index 6652f15..eed49b1 100644
--- a/generic/tclStringObj.c
+++ b/generic/tclStringObj.c
@@ -35,7 +35,7 @@
*/
#include "tclInt.h"
-#include "tommath.h"
+#include "tclTomMath.h"
#include "tclStringRep.h"
#include "assert.h"
@@ -2059,6 +2059,7 @@ Tcl_AppendFormatToObj(
}
case 'u':
+ /* FALLTHRU */
case 'd':
case 'o':
case 'p':
@@ -2270,11 +2271,11 @@ Tcl_AppendFormatToObj(
}
#endif
} else if (useBig && big.used) {
- int leftover = (big.used * DIGIT_BIT) % numBits;
- mp_digit mask = (~(mp_digit)0) << (DIGIT_BIT-leftover);
+ int leftover = (big.used * MP_DIGIT_BIT) % numBits;
+ mp_digit mask = (~(mp_digit)0) << (MP_DIGIT_BIT-leftover);
numDigits = 1 +
- (((Tcl_WideInt) big.used * DIGIT_BIT) / numBits);
+ (((Tcl_WideInt) big.used * MP_DIGIT_BIT) / numBits);
while ((mask & big.dp[big.used-1]) == 0) {
numDigits--;
mask >>= numBits;
@@ -2310,9 +2311,9 @@ Tcl_AppendFormatToObj(
if (useBig && big.used) {
if (index < big.used && (size_t) shift <
- CHAR_BIT*sizeof(Tcl_WideUInt) - DIGIT_BIT) {
+ CHAR_BIT*sizeof(Tcl_WideUInt) - MP_DIGIT_BIT) {
bits |= ((Tcl_WideUInt) big.dp[index++]) << shift;
- shift += DIGIT_BIT;
+ shift += MP_DIGIT_BIT;
}
shift -= numBits;
}
@@ -2718,6 +2719,7 @@ AppendPrintfToObjVA(
break;
case 'h':
size = -1;
+ /* FALLTHRU */
default:
p++;
}
@@ -3563,7 +3565,7 @@ TclStringFirst(
}
if (TclIsPureByteArray(needle) && TclIsPureByteArray(haystack)) {
- unsigned char *end, *try, *bh;
+ unsigned char *end, *check, *bh;
unsigned char *bn = Tcl_GetByteArrayFromObj(needle, &ln);
/* Find bytes in bytes */
@@ -3574,25 +3576,25 @@ TclStringFirst(
}
end = bh + lh;
- try = bh + start;
- while (try + ln <= end) {
+ check = bh + start;
+ while (check + ln <= end) {
/*
* Look for the leading byte of the needle in the haystack
- * starting at try and stopping when there's not enough room
+ * starting at check and stopping when there's not enough room
* for the needle left.
*/
- try = memchr(try, bn[0], (end + 1 - ln) - try);
- if (try == NULL) {
+ check = memchr(check, bn[0], (end + 1 - ln) - check);
+ if (check == NULL) {
/* Leading byte not found -> needle cannot be found. */
return -1;
}
/* Leading byte found, check rest of needle. */
- if (0 == memcmp(try+1, bn+1, ln-1)) {
+ if (0 == memcmp(check+1, bn+1, ln-1)) {
/* Checks! Return the successful index. */
- return (try - bh);
+ return (check - bh);
}
/* Rest of needle match failed; Iterate to continue search. */
- try++;
+ check++;
}
return -1;
}
@@ -3610,7 +3612,7 @@ TclStringFirst(
*/
{
- Tcl_UniChar *try, *end, *uh;
+ Tcl_UniChar *check, *end, *uh;
Tcl_UniChar *un = Tcl_GetUnicodeFromObj(needle, &ln);
uh = Tcl_GetUnicodeFromObj(haystack, &lh);
@@ -3620,10 +3622,10 @@ TclStringFirst(
}
end = uh + lh;
- for (try = uh + start; try + ln <= end; try++) {
- if ((*try == *un) && (0 ==
- memcmp(try + 1, un + 1, (ln-1) * sizeof(Tcl_UniChar)))) {
- return (try - uh);
+ for (check = uh + start; check + ln <= end; check++) {
+ if ((*check == *un) && (0 ==
+ memcmp(check + 1, un + 1, (ln-1) * sizeof(Tcl_UniChar)))) {
+ return (check - uh);
}
}
return -1;
@@ -3667,7 +3669,7 @@ TclStringLast(
}
if (TclIsPureByteArray(needle) && TclIsPureByteArray(haystack)) {
- unsigned char *try, *bh = Tcl_GetByteArrayFromObj(haystack, &lh);
+ unsigned char *check, *bh = Tcl_GetByteArrayFromObj(haystack, &lh);
unsigned char *bn = Tcl_GetByteArrayFromObj(needle, &ln);
if (last >= lh) {
@@ -3677,20 +3679,20 @@ TclStringLast(
/* Don't start the loop if there cannot be a valid answer */
return -1;
}
- try = bh + last + 1 - ln;
+ check = bh + last + 1 - ln;
- while (try >= bh) {
- if ((*try == bn[0])
- && (0 == memcmp(try+1, bn+1, ln-1))) {
- return (try - bh);
+ while (check >= bh) {
+ if ((*check == bn[0])
+ && (0 == memcmp(check+1, bn+1, ln-1))) {
+ return (check - bh);
}
- try--;
+ check--;
}
return -1;
}
{
- Tcl_UniChar *try, *uh = Tcl_GetUnicodeFromObj(haystack, &lh);
+ Tcl_UniChar *check, *uh = Tcl_GetUnicodeFromObj(haystack, &lh);
Tcl_UniChar *un = Tcl_GetUnicodeFromObj(needle, &ln);
if (last >= lh) {
@@ -3700,13 +3702,13 @@ TclStringLast(
/* Don't start the loop if there cannot be a valid answer */
return -1;
}
- try = uh + last + 1 - ln;
- while (try >= uh) {
- if ((*try == un[0])
- && (0 == memcmp(try+1, un+1, (ln-1)*sizeof(Tcl_UniChar)))) {
- return (try - uh);
+ check = uh + last + 1 - ln;
+ while (check >= uh) {
+ if ((*check == un[0])
+ && (0 == memcmp(check+1, un+1, (ln-1)*sizeof(Tcl_UniChar)))) {
+ return (check - uh);
}
- try--;
+ check--;
}
return -1;
}