svn commit: r200802 - head/lib/libc/stdio

Xin LI delphij at FreeBSD.org
Mon Dec 21 19:59:39 UTC 2009


Author: delphij
Date: Mon Dec 21 19:59:38 2009
New Revision: 200802
URL: http://svn.freebsd.org/changeset/base/200802

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

Modified:
  head/lib/libc/stdio/sprintf.c

Modified: head/lib/libc/stdio/sprintf.c
==============================================================================
--- head/lib/libc/stdio/sprintf.c	Mon Dec 21 19:56:11 2009	(r200801)
+++ head/lib/libc/stdio/sprintf.c	Mon Dec 21 19:59:38 2009	(r200802)
@@ -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-all mailing list