diff options
author | jhb <jhb@FreeBSD.org> | 2010-03-11 17:03:32 +0000 |
---|---|---|
committer | jhb <jhb@FreeBSD.org> | 2010-03-11 17:03:32 +0000 |
commit | 2684d78c89ad7cfd18346398691e6e03d263f6c6 (patch) | |
tree | e077a892f44aba8196f30652e58ab6d758a2af4a /lib/libc/stdio/vswscanf.c | |
parent | 03101f1cf6eaf4791f0ae5844d6c40b9f282a3ef (diff) | |
download | FreeBSD-src-2684d78c89ad7cfd18346398691e6e03d263f6c6.zip FreeBSD-src-2684d78c89ad7cfd18346398691e6e03d263f6c6.tar.gz |
- Use an initializer macro to initialize fields in 'fake' FILE objects used
by *sprintf(), etc.
- Explicitly initialize _fl_mutex to PTHREAD_MUTEX_INITIALIZER for all FILE
objects. This is currently a nop on FreeBSD, but is import for other
platforms (or in the future) where PTHREAD_MUTEX_INITIALIZER is not simply
zero.
PR: threads/141198
Reported by: Jeremy Huddleston @ Apple
MFC after: 2 weeks
Diffstat (limited to 'lib/libc/stdio/vswscanf.c')
-rw-r--r-- | lib/libc/stdio/vswscanf.c | 7 |
1 files changed, 1 insertions, 6 deletions
diff --git a/lib/libc/stdio/vswscanf.c b/lib/libc/stdio/vswscanf.c index 8a70d44..f06fc02 100644 --- a/lib/libc/stdio/vswscanf.c +++ b/lib/libc/stdio/vswscanf.c @@ -62,7 +62,7 @@ vswscanf(const wchar_t * __restrict str, const wchar_t * __restrict fmt, { static const mbstate_t initial; mbstate_t mbs; - FILE f; + FILE f = FAKE_FILE; char *mbstr; size_t mlen; int r; @@ -80,15 +80,10 @@ vswscanf(const wchar_t * __restrict str, const wchar_t * __restrict fmt, free(mbstr); return (EOF); } - f._file = -1; f._flags = __SRD; f._bf._base = f._p = (unsigned char *)mbstr; f._bf._size = f._r = mlen; f._read = eofread; - f._ub._base = NULL; - f._lb._base = NULL; - f._orientation = 0; - memset(&f._mbstate, 0, sizeof(mbstate_t)); r = __vfwscanf(&f, fmt, ap); free(mbstr); |