]> git.saurik.com Git - apple/libc.git/blobdiff - stdio/FreeBSD/vsprintf.c.patch
Libc-391.tar.gz
[apple/libc.git] / stdio / FreeBSD / vsprintf.c.patch
diff --git a/stdio/FreeBSD/vsprintf.c.patch b/stdio/FreeBSD/vsprintf.c.patch
new file mode 100644 (file)
index 0000000..a01a91b
--- /dev/null
@@ -0,0 +1,40 @@
+--- vsprintf.c.orig    2003-05-20 15:22:44.000000000 -0700
++++ vsprintf.c 2005-02-23 16:56:03.000000000 -0800
+@@ -40,6 +40,8 @@
+ #include <sys/cdefs.h>
+ __FBSDID("$FreeBSD: src/lib/libc/stdio/vsprintf.c,v 1.14 2002/09/06 11:23:56 tjr Exp $");
++#include "xlocale_private.h"
++
+ #include <stdio.h>
+ #include <limits.h>
+ #include "local.h"
+@@ -57,7 +59,27 @@
+       f._bf._size = f._w = INT_MAX;
+       f._extra = &ext;
+       INITEXTRA(&f);
+-      ret = __vfprintf(&f, fmt, ap);
++      ret = __vfprintf(&f, __current_locale(), fmt, ap);
++      *f._p = 0;
++      return (ret);
++}
++
++int
++vsprintf_l(char * __restrict str, locale_t loc, const char * __restrict fmt,
++    __va_list ap)
++{
++      int ret;
++      FILE f;
++      struct __sFILEX ext;
++
++      NORMALIZE_LOCALE(loc);
++      f._file = -1;
++      f._flags = __SWR | __SSTR;
++      f._bf._base = f._p = (unsigned char *)str;
++      f._bf._size = f._w = INT_MAX;
++      f._extra = &ext;
++      INITEXTRA(&f);
++      ret = __vfprintf(&f, loc, fmt, ap);
+       *f._p = 0;
+       return (ret);
+ }