Skip site navigation (1)Skip section navigation (2)
Date:      Mon, 21 Dec 2009 19:59:39 +0000 (UTC)
From:      Xin LI <delphij@FreeBSD.org>
To:        src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org
Subject:   svn commit: r200802 - head/lib/libc/stdio
Message-ID:  <200912211959.nBLJxdfK038986@svn.freebsd.org>

next in thread | raw e-mail | index | archive | help
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);
 }



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?200912211959.nBLJxdfK038986>