]> git.saurik.com Git - apple/libc.git/blobdiff - stdio/FreeBSD/vdprintf.c.patch
Libc-763.11.tar.gz
[apple/libc.git] / stdio / FreeBSD / vdprintf.c.patch
diff --git a/stdio/FreeBSD/vdprintf.c.patch b/stdio/FreeBSD/vdprintf.c.patch
new file mode 100644 (file)
index 0000000..519239b
--- /dev/null
@@ -0,0 +1,44 @@
+--- vdprintf.c.orig    2009-12-15 17:43:09.000000000 -0800
++++ vdprintf.c 2009-12-15 18:09:12.000000000 -0800
+@@ -27,6 +27,8 @@
+ #include <sys/cdefs.h>
+ __FBSDID("$FreeBSD: src/lib/libc/stdio/vdprintf.c,v 1.1 2009/03/04 03:38:51 das Exp $");
++#include "xlocale_private.h"
++
+ #include "namespace.h"
+ #include <errno.h>
+ #include <limits.h>
+@@ -37,11 +39,16 @@ __FBSDID("$FreeBSD: src/lib/libc/stdio/v
+ #include "local.h"
+ int
+-vdprintf(int fd, const char * __restrict fmt, va_list ap)
++vdprintf_l(int fd, locale_t loc, const char * __restrict fmt, va_list ap)
+ {
+       FILE f;
+       unsigned char buf[BUFSIZ];
+       int ret;
++      struct __sFILEX ext;
++      f._extra = &ext;
++      INITEXTRA(&f);
++
++      NORMALIZE_LOCALE(loc);
+       if (fd > SHRT_MAX) {
+               errno = EMFILE;
+@@ -59,8 +66,13 @@ vdprintf(int fd, const char * __restrict
+       f._orientation = 0;
+       bzero(&f._mbstate, sizeof(f._mbstate));
+-      if ((ret = __vfprintf(&f, fmt, ap)) < 0)
++      if ((ret = __vfprintf(&f, loc, fmt, ap)) < 0)
+               return (ret);
+       return (__fflush(&f) ? EOF : ret);
+ }
++
++int
++vdprintf(int fd, const char * __restrict fmt, va_list ap) {
++      return vdprintf_l(fd, __current_locale(), fmt, ap);
++}