summaryrefslogtreecommitdiffstats
path: root/lib/libc/locale/wcstombs.c
diff options
context:
space:
mode:
authortjr <tjr@FreeBSD.org>2002-10-27 10:41:21 +0000
committertjr <tjr@FreeBSD.org>2002-10-27 10:41:21 +0000
commitdd9e331ae288a8ca739bb13755c0849aa4793249 (patch)
treefac23295d346506f8efe21b089d1944170c3db0c /lib/libc/locale/wcstombs.c
parentc9805dcdfb391e619bc3f9a1ae0dcde7c19b3711 (diff)
downloadFreeBSD-src-dd9e331ae288a8ca739bb13755c0849aa4793249.zip
FreeBSD-src-dd9e331ae288a8ca739bb13755c0849aa4793249.tar.gz
Style sweep.
Diffstat (limited to 'lib/libc/locale/wcstombs.c')
-rw-r--r--lib/libc/locale/wcstombs.c17
1 files changed, 7 insertions, 10 deletions
diff --git a/lib/libc/locale/wcstombs.c b/lib/libc/locale/wcstombs.c
index 25652a8..796e3c2 100644
--- a/lib/libc/locale/wcstombs.c
+++ b/lib/libc/locale/wcstombs.c
@@ -44,16 +44,13 @@ __FBSDID("$FreeBSD$");
#include <rune.h>
size_t
-wcstombs(s, pwcs, n)
- char * __restrict s;
- const wchar_t * __restrict pwcs;
- size_t n;
+wcstombs(char * __restrict s, const wchar_t * __restrict pwcs, size_t n)
{
char buf[MB_LEN_MAX];
char *e;
int cnt, nb;
- if (!pwcs || n > INT_MAX) {
+ if (pwcs == NULL || n > INT_MAX) {
errno = EINVAL;
return (-1);
}
@@ -63,7 +60,7 @@ wcstombs(s, pwcs, n)
if (s == NULL) {
/* Convert and count only, do not store. */
while (*pwcs != L'\0') {
- if (!sputrune(*pwcs++, buf, MB_LEN_MAX, &e)) {
+ if (sputrune(*pwcs++, buf, MB_LEN_MAX, &e) == 0) {
errno = EILSEQ;
return (-1);
}
@@ -75,15 +72,15 @@ wcstombs(s, pwcs, n)
/* Convert, store and count characters. */
nb = n;
while (nb > 0) {
- if (*pwcs == 0) {
- *s = 0;
+ if (*pwcs == L'\0') {
+ *s = '\0';
break;
}
- if (!sputrune(*pwcs++, s, nb, &e)) {
+ if (sputrune(*pwcs++, s, nb, &e) == 0) {
errno = EILSEQ;
return (-1);
}
- if (!e) /* too long */
+ if (e == NULL) /* too long */
return (cnt);
cnt += e - s;
nb -= e - s;
OpenPOWER on IntegriCloud