aboutsummaryrefslogtreecommitdiff
path: root/lib
diff options
context:
space:
mode:
authorAndrey A. Chernov <ache@FreeBSD.org>2002-08-19 18:06:18 +0000
committerAndrey A. Chernov <ache@FreeBSD.org>2002-08-19 18:06:18 +0000
commit1e2cd54448c087f9938c85de23d03710061129a7 (patch)
treec15197c4a811b73be6f5e1ec16f1daa7633640bb /lib
parent27f2eac7f3ad8d96bd12567a25b739095ca39f29 (diff)
downloadsrc-1e2cd54448c087f9938c85de23d03710061129a7.tar.gz
src-1e2cd54448c087f9938c85de23d03710061129a7.zip
According to SUSv2, always return 0 for null wide-character code
Notes
Notes: svn path=/head/; revision=102124
Diffstat (limited to 'lib')
-rw-r--r--lib/libc/locale/wcwidth.c7
1 files changed, 6 insertions, 1 deletions
diff --git a/lib/libc/locale/wcwidth.c b/lib/libc/locale/wcwidth.c
index dab0808a5f1e..b2d70a5c9e93 100644
--- a/lib/libc/locale/wcwidth.c
+++ b/lib/libc/locale/wcwidth.c
@@ -52,7 +52,12 @@ int
wcwidth(wc)
wchar_t wc;
{
- int width = __maskrune(wc, _CTYPE_SWM);
+ int width;
+
+ if (wc == 0)
+ return (0);
+
+ width = __maskrune(wc, _CTYPE_SWM);
/* 0 is autowidth (default) */
return (width ? (int)((unsigned)width >> _CTYPE_SWS)