summaryrefslogtreecommitdiff
path: root/sys
diff options
context:
space:
mode:
authorKenneth R Westerback <krw@cvs.openbsd.org>2005-12-17 17:42:57 +0000
committerKenneth R Westerback <krw@cvs.openbsd.org>2005-12-17 17:42:57 +0000
commit840d6f0ac1530b4b3544f19962582331db245f30 (patch)
tree9da997eceff28ef7dec06ab65d7a165ec40a8d10 /sys
parent9dd2d005e1e46bde7adf8e0c093733a1f9f317f9 (diff)
Replace 'while (j>=0)' constructs with safer, more KNF friendly for()
loops because j is unsigned. Comments from Marco Hyman and Andreas Gunnarson fixed my first version. Spotted by lint. 'go for it' deraadt@ for initial version.
Diffstat (limited to 'sys')
-rw-r--r--sys/dev/pci/safe.c12
1 files changed, 3 insertions, 9 deletions
diff --git a/sys/dev/pci/safe.c b/sys/dev/pci/safe.c
index a69fedeb9f7..615cb4c4ae6 100644
--- a/sys/dev/pci/safe.c
+++ b/sys/dev/pci/safe.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: safe.c,v 1.16 2005/11/09 05:59:50 brad Exp $ */
+/* $OpenBSD: safe.c,v 1.17 2005/12/17 17:42:56 krw Exp $ */
/*-
* Copyright (c) 2003 Sam Leffler, Errno Consulting
@@ -1600,10 +1600,7 @@ safe_mcopy(struct mbuf *srcm, struct mbuf *dstm, u_int offset)
/*
* Advance src and dst to offset.
*/
- j = offset;
- while (j >= 0) {
- if (srcm->m_len > j)
- break;
+ for (j = offset; srcm->m_len <= j;) {
j -= srcm->m_len;
srcm = srcm->m_next;
if (srcm == NULL)
@@ -1612,10 +1609,7 @@ safe_mcopy(struct mbuf *srcm, struct mbuf *dstm, u_int offset)
sptr = mtod(srcm, caddr_t) + j;
slen = srcm->m_len - j;
- j = offset;
- while (j >= 0) {
- if (dstm->m_len > j)
- break;
+ for (j = offset; dstm->m_len <= j;) {
j -= dstm->m_len;
dstm = dstm->m_next;
if (dstm == NULL)