]> git.saurik.com Git - apple/libc.git/blame - stdio/FreeBSD/vsprintf.c.patch
Libc-594.9.5.tar.gz
[apple/libc.git] / stdio / FreeBSD / vsprintf.c.patch
CommitLineData
3d9156a7
A
1--- vsprintf.c.orig 2003-05-20 15:22:44.000000000 -0700
2+++ vsprintf.c 2005-02-23 16:56:03.000000000 -0800
3@@ -40,6 +40,8 @@
4 #include <sys/cdefs.h>
5 __FBSDID("$FreeBSD: src/lib/libc/stdio/vsprintf.c,v 1.14 2002/09/06 11:23:56 tjr Exp $");
6
7+#include "xlocale_private.h"
8+
9 #include <stdio.h>
10 #include <limits.h>
11 #include "local.h"
12@@ -57,7 +59,27 @@
13 f._bf._size = f._w = INT_MAX;
14 f._extra = &ext;
15 INITEXTRA(&f);
16- ret = __vfprintf(&f, fmt, ap);
17+ ret = __vfprintf(&f, __current_locale(), fmt, ap);
18+ *f._p = 0;
19+ return (ret);
20+}
21+
22+int
23+vsprintf_l(char * __restrict str, locale_t loc, const char * __restrict fmt,
24+ __va_list ap)
25+{
26+ int ret;
27+ FILE f;
28+ struct __sFILEX ext;
29+
30+ NORMALIZE_LOCALE(loc);
31+ f._file = -1;
32+ f._flags = __SWR | __SSTR;
33+ f._bf._base = f._p = (unsigned char *)str;
34+ f._bf._size = f._w = INT_MAX;
35+ f._extra = &ext;
36+ INITEXTRA(&f);
37+ ret = __vfprintf(&f, loc, fmt, ap);
38 *f._p = 0;
39 return (ret);
40 }