1 --- gbk.c.orig 2009-11-09 15:05:25.000000000 -0800
2 +++ gbk.c 2009-11-09 16:27:30.000000000 -0800
5 __FBSDID("$FreeBSD: src/lib/libc/locale/gbk.c,v 1.14 2007/10/13 16:28:21 ache Exp $");
7 +#include "xlocale_private.h"
12 @@ -42,33 +44,30 @@ __FBSDID("$FreeBSD: src/lib/libc/locale/
16 -extern int __mb_sb_limit;
18 static size_t _GBK_mbrtowc(wchar_t * __restrict, const char * __restrict,
19 - size_t, mbstate_t * __restrict);
20 -static int _GBK_mbsinit(const mbstate_t *);
21 + size_t, mbstate_t * __restrict, locale_t);
22 +static int _GBK_mbsinit(const mbstate_t *, locale_t);
23 static size_t _GBK_wcrtomb(char * __restrict, wchar_t,
24 - mbstate_t * __restrict);
25 + mbstate_t * __restrict, locale_t);
32 -_GBK_init(_RuneLocale *rl)
33 +__private_extern__ int
34 +_GBK_init(struct __xlocale_st_runelocale *xrl)
37 - __mbrtowc = _GBK_mbrtowc;
38 - __wcrtomb = _GBK_wcrtomb;
39 - __mbsinit = _GBK_mbsinit;
40 - _CurrentRuneLocale = rl;
42 - __mb_sb_limit = 128;
43 + xrl->__mbrtowc = _GBK_mbrtowc;
44 + xrl->__wcrtomb = _GBK_wcrtomb;
45 + xrl->__mbsinit = _GBK_mbsinit;
46 + xrl->__mb_cur_max = 2;
47 + xrl->__mb_sb_limit = 128;
52 -_GBK_mbsinit(const mbstate_t *ps)
53 +_GBK_mbsinit(const mbstate_t *ps, locale_t loc __unused)
56 return (ps == NULL || ((const _GBKState *)ps)->ch == 0);
57 @@ -84,7 +83,7 @@ _gbk_check(u_int c)
60 _GBK_mbrtowc(wchar_t * __restrict pwc, const char * __restrict s, size_t n,
61 - mbstate_t * __restrict ps)
62 + mbstate_t * __restrict ps, locale_t loc __unused)
66 @@ -144,7 +143,7 @@ _GBK_mbrtowc(wchar_t * __restrict pwc, c
70 -_GBK_wcrtomb(char * __restrict s, wchar_t wc, mbstate_t * __restrict ps)
71 +_GBK_wcrtomb(char * __restrict s, wchar_t wc, mbstate_t * __restrict ps, locale_t loc __unused)