Loading...
stdio/FreeBSD/snprintf.c.patch Libc-583 /dev/null
--- Libc/Libc-583/stdio/FreeBSD/snprintf.c.patch
+++ /dev/null
@@ -1,50 +0,0 @@
---- snprintf.c.orig	2003-05-20 15:22:43.000000000 -0700
-+++ snprintf.c	2005-02-23 16:39:33.000000000 -0800
-@@ -40,6 +40,8 @@
- #include <sys/cdefs.h>
- __FBSDID("$FreeBSD: src/lib/libc/stdio/snprintf.c,v 1.20 2002/09/06 11:23:55 tjr Exp $");
- 
-+#include "xlocale_private.h"
-+
- #include <limits.h>
- #include <stdio.h>
- #include <stdarg.h>
-@@ -67,7 +69,37 @@
- 	f._bf._size = f._w = n;
- 	f._extra = &ext;
- 	INITEXTRA(&f);
--	ret = __vfprintf(&f, fmt, ap);
-+	ret = __vfprintf(&f, __current_locale(), fmt, ap);
-+	if (on > 0)
-+		*f._p = '\0';
-+	va_end(ap);
-+	return (ret);
-+}
-+
-+int
-+snprintf_l(char * __restrict str, size_t n, locale_t loc,
-+    char const * __restrict fmt, ...)
-+{
-+	size_t on;
-+	int ret;
-+	va_list ap;
-+	FILE f;
-+	struct __sFILEX ext;
-+
-+	NORMALIZE_LOCALE(loc);
-+	on = n;
-+	if (n != 0)
-+		n--;
-+	if (n > INT_MAX)
-+		n = INT_MAX;
-+	va_start(ap, fmt);
-+	f._file = -1;
-+	f._flags = __SWR | __SSTR;
-+	f._bf._base = f._p = (unsigned char *)str;
-+	f._bf._size = f._w = n;
-+	f._extra = &ext;
-+	INITEXTRA(&f);
-+	ret = __vfprintf(&f, loc, fmt, ap);
- 	if (on > 0)
- 		*f._p = '\0';
- 	va_end(ap);