diff options
author | millert <> | 2006-05-05 15:27:38 +0000 |
---|---|---|
committer | millert <> | 2006-05-05 15:27:38 +0000 |
commit | 2be1a0fbd662e968bf825e9d7ad192f271f0fa28 (patch) | |
tree | ff96850d147bd0882517b74f1e408d3489fd0d4a | |
parent | f9d2303788ae22bedb13da8c57c49011b74de60a (diff) | |
download | openbsd-2be1a0fbd662e968bf825e9d7ad192f271f0fa28.tar.gz openbsd-2be1a0fbd662e968bf825e9d7ad192f271f0fa28.tar.bz2 openbsd-2be1a0fbd662e968bf825e9d7ad192f271f0fa28.zip |
Convert do {} while loop -> while {} for clarity. No binary change
on most architectures. From Oliver Smith. OK deraadt@ and henning@
-rw-r--r-- | src/lib/libc/string/strlcpy.c | 10 | ||||
-rw-r--r-- | src/lib/libc/string/wcslcpy.c | 10 |
2 files changed, 10 insertions, 10 deletions
diff --git a/src/lib/libc/string/strlcpy.c b/src/lib/libc/string/strlcpy.c index 110155f76f..d32b6590f1 100644 --- a/src/lib/libc/string/strlcpy.c +++ b/src/lib/libc/string/strlcpy.c | |||
@@ -1,4 +1,4 @@ | |||
1 | /* $OpenBSD: strlcpy.c,v 1.10 2005/08/08 08:05:37 espie Exp $ */ | 1 | /* $OpenBSD: strlcpy.c,v 1.11 2006/05/05 15:27:38 millert Exp $ */ |
2 | 2 | ||
3 | /* | 3 | /* |
4 | * Copyright (c) 1998 Todd C. Miller <Todd.Miller@courtesan.com> | 4 | * Copyright (c) 1998 Todd C. Miller <Todd.Miller@courtesan.com> |
@@ -32,11 +32,11 @@ strlcpy(char *dst, const char *src, size_t siz) | |||
32 | size_t n = siz; | 32 | size_t n = siz; |
33 | 33 | ||
34 | /* Copy as many bytes as will fit */ | 34 | /* Copy as many bytes as will fit */ |
35 | if (n != 0 && --n != 0) { | 35 | if (n != 0) { |
36 | do { | 36 | while (--n != 0) { |
37 | if ((*d++ = *s++) == 0) | 37 | if ((*d++ = *s++) == '\0') |
38 | break; | 38 | break; |
39 | } while (--n != 0); | 39 | } |
40 | } | 40 | } |
41 | 41 | ||
42 | /* Not enough room in dst, add NUL and traverse rest of src */ | 42 | /* Not enough room in dst, add NUL and traverse rest of src */ |
diff --git a/src/lib/libc/string/wcslcpy.c b/src/lib/libc/string/wcslcpy.c index 4a9afffd98..85f51df35f 100644 --- a/src/lib/libc/string/wcslcpy.c +++ b/src/lib/libc/string/wcslcpy.c | |||
@@ -1,4 +1,4 @@ | |||
1 | /* $OpenBSD: wcslcpy.c,v 1.3 2005/08/08 08:05:37 espie Exp $ */ | 1 | /* $OpenBSD: wcslcpy.c,v 1.4 2006/05/05 15:27:38 millert Exp $ */ |
2 | /* $NetBSD: wcslcpy.c,v 1.2 2001/01/03 14:33:02 lukem Exp $ */ | 2 | /* $NetBSD: wcslcpy.c,v 1.2 2001/01/03 14:33:02 lukem Exp $ */ |
3 | /* from OpenBSD: strlcpy.c,v 1.4 1999/05/01 18:56:41 millert Exp */ | 3 | /* from OpenBSD: strlcpy.c,v 1.4 1999/05/01 18:56:41 millert Exp */ |
4 | 4 | ||
@@ -45,11 +45,11 @@ wcslcpy(wchar_t *dst, const wchar_t *src, size_t siz) | |||
45 | size_t n = siz; | 45 | size_t n = siz; |
46 | 46 | ||
47 | /* Copy as many bytes as will fit */ | 47 | /* Copy as many bytes as will fit */ |
48 | if (n != 0 && --n != 0) { | 48 | if (n != 0) { |
49 | do { | 49 | while (--n != 0) { |
50 | if ((*d++ = *s++) == 0) | 50 | if ((*d++ = *s++) == '\0') |
51 | break; | 51 | break; |
52 | } while (--n != 0); | 52 | } |
53 | } | 53 | } |
54 | 54 | ||
55 | /* Not enough room in dst, add NUL and traverse rest of src */ | 55 | /* Not enough room in dst, add NUL and traverse rest of src */ |