]> git.saurik.com Git - apple/libc.git/blob - stdio/FreeBSD/vsprintf.c.patch
1a5986059f3b784b8610a339b2c4bdd24e8a33db
[apple/libc.git] / stdio / FreeBSD / vsprintf.c.patch
1 --- vsprintf.c.orig 2009-11-30 16:15:30.000000000 -0800
2 +++ vsprintf.c 2009-12-03 15:20:55.000000000 -0800
3 @@ -36,23 +36,35 @@ static char sccsid[] = "@(#)vsprintf.c 8
4 #include <sys/cdefs.h>
5 __FBSDID("$FreeBSD: src/lib/libc/stdio/vsprintf.c,v 1.16 2008/04/17 22:17:54 jhb Exp $");
6
7 +#include "xlocale_private.h"
8 +
9 #include <stdio.h>
10 #include <limits.h>
11 #include "local.h"
12
13 int
14 -vsprintf(char * __restrict str, const char * __restrict fmt, __va_list ap)
15 +vsprintf_l(char * __restrict str, locale_t loc, const char * __restrict fmt, __va_list ap)
16 {
17 int ret;
18 FILE f;
19 + struct __sFILEX ext;
20 + f._extra = &ext;
21 + INITEXTRA(&f);
22
23 + NORMALIZE_LOCALE(loc);
24 f._file = -1;
25 f._flags = __SWR | __SSTR;
26 f._bf._base = f._p = (unsigned char *)str;
27 f._bf._size = f._w = INT_MAX;
28 f._orientation = 0;
29 memset(&f._mbstate, 0, sizeof(mbstate_t));
30 - ret = __vfprintf(&f, fmt, ap);
31 + ret = __vfprintf(&f, loc, fmt, ap);
32 *f._p = 0;
33 return (ret);
34 }
35 +
36 +int
37 +vsprintf(char * __restrict str, const char * __restrict fmt, __va_list ap)
38 +{
39 + return vsprintf_l(str, __current_locale(), fmt, ap);
40 +}