]> git.saurik.com Git - apple/libc.git/blob - string/FreeBSD/wcswidth.c.patch
58c04487b96081adabfde5e7fa2796d577f3df6b
[apple/libc.git] / string / FreeBSD / wcswidth.c.patch
1 --- wcswidth.c.orig 2003-05-20 15:23:56.000000000 -0700
2 +++ wcswidth.c 2005-02-25 00:12:43.000000000 -0800
3 @@ -42,20 +42,30 @@
4 #include <sys/cdefs.h>
5 __FBSDID("$FreeBSD: src/lib/libc/string/wcswidth.c,v 1.6 2002/08/20 02:06:28 ache Exp $");
6
7 +#include "xlocale_private.h"
8 +
9 #include <wchar.h>
10
11 int
12 -wcswidth(const wchar_t *pwcs, size_t n)
13 +wcswidth_l(const wchar_t *pwcs, size_t n, locale_t loc)
14 {
15 wchar_t wc;
16 int len, l;
17
18 + NORMALIZE_LOCALE(loc);
19 len = 0;
20 while (n-- > 0 && (wc = *pwcs++) != L'\0') {
21 - if ((l = wcwidth(wc)) < 0)
22 + if ((l = wcwidth_l(wc, loc)) < 0)
23 return (-1);
24 len += l;
25 }
26 return (len);
27 }
28
29 +
30 +int
31 +wcswidth(const wchar_t *pwcs, size_t n)
32 +{
33 + return wcswidth_l(pwcs, n, __current_locale());
34 +}
35 +