Use vsprintf instead of rolling our own.

PR:		bin/140496
Submitted by:	Jeremy Huddleston <jeremyhu apple.com>
MFC after:	1 month
This commit is contained in:
Xin LI 2009-12-21 19:59:38 +00:00
parent 42306cb0b3
commit 280101b76e

View File

@ -46,17 +46,9 @@ sprintf(char * __restrict str, char const * __restrict fmt, ...)
{
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);
}