]> git.saurik.com Git - apple/libc.git/blame_incremental - stdio/FreeBSD/vdprintf.c.patch
Libc-763.13.tar.gz
[apple/libc.git] / stdio / FreeBSD / vdprintf.c.patch
... / ...
CommitLineData
1--- vdprintf.c.orig 2009-12-15 17:43:09.000000000 -0800
2+++ vdprintf.c 2009-12-15 18:09:12.000000000 -0800
3@@ -27,6 +27,8 @@
4 #include <sys/cdefs.h>
5 __FBSDID("$FreeBSD: src/lib/libc/stdio/vdprintf.c,v 1.1 2009/03/04 03:38:51 das Exp $");
6
7+#include "xlocale_private.h"
8+
9 #include "namespace.h"
10 #include <errno.h>
11 #include <limits.h>
12@@ -37,11 +39,16 @@ __FBSDID("$FreeBSD: src/lib/libc/stdio/v
13 #include "local.h"
14
15 int
16-vdprintf(int fd, const char * __restrict fmt, va_list ap)
17+vdprintf_l(int fd, locale_t loc, const char * __restrict fmt, va_list ap)
18 {
19 FILE f;
20 unsigned char buf[BUFSIZ];
21 int ret;
22+ struct __sFILEX ext;
23+ f._extra = &ext;
24+ INITEXTRA(&f);
25+
26+ NORMALIZE_LOCALE(loc);
27
28 if (fd > SHRT_MAX) {
29 errno = EMFILE;
30@@ -59,8 +66,13 @@ vdprintf(int fd, const char * __restrict
31 f._orientation = 0;
32 bzero(&f._mbstate, sizeof(f._mbstate));
33
34- if ((ret = __vfprintf(&f, fmt, ap)) < 0)
35+ if ((ret = __vfprintf(&f, loc, fmt, ap)) < 0)
36 return (ret);
37
38 return (__fflush(&f) ? EOF : ret);
39 }
40+
41+int
42+vdprintf(int fd, const char * __restrict fmt, va_list ap) {
43+ return vdprintf_l(fd, __current_locale(), fmt, ap);
44+}