]> git.saurik.com Git - apple/libc.git/blobdiff - string/FreeBSD/wcswidth.c
Libc-1044.40.1.tar.gz
[apple/libc.git] / string / FreeBSD / wcswidth.c
index 5a3801276f2fe8e8fb79a1d1baf66d5e6f4fae56..447c8e53e4358006447f6de733e63767fa918636 100644 (file)
 #include <sys/cdefs.h>
 __FBSDID("$FreeBSD: src/lib/libc/string/wcswidth.c,v 1.7 2007/01/09 00:28:12 imp Exp $");
 
+#include "xlocale_private.h"
+
 #include <wchar.h>
 
 int
-wcswidth(const wchar_t *pwcs, size_t n)
+wcswidth_l(const wchar_t *pwcs, size_t n, locale_t loc)
 {
        wchar_t wc;
        int len, l;
 
+       NORMALIZE_LOCALE(loc);
        len = 0;
        while (n-- > 0 && (wc = *pwcs++) != L'\0') {
-               if ((l = wcwidth(wc)) < 0)
+               if ((l = wcwidth_l(wc, loc)) < 0)
                        return (-1);
                len += l;
        }
        return (len);
 }
 
+
+int
+wcswidth(const wchar_t *pwcs, size_t n)
+{
+       return wcswidth_l(pwcs, n, __current_locale());
+}
+