svn commit: r202666 - stable/8/lib/libc/stdio

Xin LI delphij at FreeBSD.org
Wed Jan 20 00:53:45 UTC 2010


Author: delphij
Date: Wed Jan 20 00:53:44 2010
New Revision: 202666
URL: http://svn.freebsd.org/changeset/base/202666

Log:
  MFC r200802:
  
  Use vsprintf instead of rolling our own.
  
  PR:		bin/140496
  Submitted by:	Jeremy Huddleston <jeremyhu apple.com>

Modified:
  stable/8/lib/libc/stdio/sprintf.c
Directory Properties:
  stable/8/lib/libc/   (props changed)
  stable/8/lib/libc/stdtime/   (props changed)

Modified: stable/8/lib/libc/stdio/sprintf.c
==============================================================================
--- stable/8/lib/libc/stdio/sprintf.c	Wed Jan 20 00:53:03 2010	(r202665)
+++ stable/8/lib/libc/stdio/sprintf.c	Wed Jan 20 00:53:44 2010	(r202666)
@@ -46,17 +46,9 @@ sprintf(char * __restrict str, char cons
 {
 	int ret;
 	va_list ap;
-	FILE f;
 
-	f._file = -1;
-	f._flags = __SWR | __SSTR;
-	f._bf._base = f._p = (unsigned char *)str;
-	f._bf._size = f._w = INT_MAX;
-	f._orientation = 0;
-	memset(&f._mbstate, 0, sizeof(mbstate_t));
 	va_start(ap, fmt);
-	ret = __vfprintf(&f, fmt, ap);
+	ret = vsprintf(str, fmt, ap);
 	va_end(ap);
-	*f._p = 0;
 	return (ret);
 }


More information about the svn-src-stable-8 mailing list