diff options
| author | christos <christos@NetBSD.org> | 2001-05-22 18:56:33 +0000 |
|---|---|---|
| committer | christos <christos@NetBSD.org> | 2001-05-22 18:56:33 +0000 |
| commit | cff5ca4be665b879d656c95eb9d1c92f242e2d07 (patch) | |
| tree | 90c6215f5cac34ea52d7ed671a3268c4bc94a388 /lib/libc/string | |
| parent | 822c8273de321eb09ba1988be85ddc5ee156e453 (diff) | |
fix incorrect loop sentinel caused by previous de-linting.
Diffstat (limited to 'lib/libc/string')
| -rw-r--r-- | lib/libc/string/swab.c | 15 |
1 files changed, 8 insertions, 7 deletions
diff --git a/lib/libc/string/swab.c b/lib/libc/string/swab.c index f70131eefa1..5600263f2c6 100644 --- a/lib/libc/string/swab.c +++ b/lib/libc/string/swab.c @@ -1,4 +1,4 @@ -/* $NetBSD: swab.c,v 1.10 2001/01/26 10:53:30 wiz Exp $ */ +/* $NetBSD: swab.c,v 1.11 2001/05/22 18:56:33 christos Exp $ */ /* * Copyright (c) 1988, 1993 @@ -41,7 +41,7 @@ #if 0 static char sccsid[] = "@(#)swab.c 8.1 (Berkeley) 6/4/93"; #else -__RCSID("$NetBSD: swab.c,v 1.10 2001/01/26 10:53:30 wiz Exp $"); +__RCSID("$NetBSD: swab.c,v 1.11 2001/05/22 18:56:33 christos Exp $"); #endif #endif /* LIBC_SCCS and not lint */ @@ -52,22 +52,23 @@ void swab(const void *from, void *to, size_t len) { char temp; - size_t n; const char *fp; char *tp; _DIAGASSERT(from != NULL); _DIAGASSERT(to != NULL); - n = (len >> 1) + 1; + len = (len / 2) + 1; fp = (const char *)from; tp = (char *)to; #define STEP temp = *fp++,*tp++ = *fp++,*tp++ = temp /* round to multiple of 8 */ - while ((--n) & 07) + while ((--len & 07) != 0) STEP; - n >>= 3; - while (--n >= 0) { + len >>= 3; + if (len == 0) + return; + while (len-- != 0) { STEP; STEP; STEP; STEP; STEP; STEP; STEP; STEP; } |
