summaryrefslogtreecommitdiffstats
path: root/compat
diff options
context:
space:
mode:
authordkf <dkf@noemail.net>2007-01-22 09:56:31 (GMT)
committerdkf <dkf@noemail.net>2007-01-22 09:56:31 (GMT)
commit122a057f83d3c731f21d5cf4f9c3ec67360ce51a (patch)
treec435470ac8667e76f680ae55177b80fdb6db96b1 /compat
parentb52c19b6d7538720fca0e67f0e38eb8872e8741a (diff)
downloadtcl-122a057f83d3c731f21d5cf4f9c3ec67360ce51a.zip
tcl-122a057f83d3c731f21d5cf4f9c3ec67360ce51a.tar.gz
tcl-122a057f83d3c731f21d5cf4f9c3ec67360ce51a.tar.bz2
Fix [Bug 1631017]
FossilOrigin-Name: 43fa0fcf12989a74fcd9dc282d25247f2127475a
Diffstat (limited to 'compat')
-rw-r--r--compat/memcmp.c9
1 files changed, 5 insertions, 4 deletions
diff --git a/compat/memcmp.c b/compat/memcmp.c
index 09a5724..dd4cacc 100644
--- a/compat/memcmp.c
+++ b/compat/memcmp.c
@@ -48,11 +48,12 @@ memcmp(s1, s2, n)
CONST VOID *s2; /* Second string. */
size_t n; /* Length to compare. */
{
- unsigned char u1, u2;
+ VOID unsigned char *ptr1 = (VOID unsigned char *) s1;
+ VOID unsigned char *ptr2 = (VOID unsigned char *) s2;
+
+ for ( ; n-- ; ptr1++, ptr2++) {
+ unsigned char u1 = *s1, u2 = *s2;
- for ( ; n-- ; s1++, s2++) {
- u1 = * (unsigned char *) s1;
- u2 = * (unsigned char *) s2;
if ( u1 != u2) {
return (u1-u2);
}