From b87eb3f8feb826ac48463f598fc10476055bee5a Mon Sep 17 00:00:00 2001 From: Zack Weinberg Date: Wed, 7 Mar 2018 14:31:59 -0500 Subject: Use SCANF_ISOC99_A instead of _IO_FLAGS2_SCANF_STD. Change the callers of __vfscanf_internal and __vfwscanf_internal that want C99-compliant behavior to communicate this via the new flags argument, rather than setting bits on the FILE object. This also means these functions do not need to do their own locking. Tested for powerpc and powerpc64le. --- wcsmbs/isoc99_fwscanf.c | 7 +------ wcsmbs/isoc99_swscanf.c | 3 +-- wcsmbs/isoc99_vfwscanf.c | 9 +-------- wcsmbs/isoc99_vswscanf.c | 3 +-- wcsmbs/isoc99_vwscanf.c | 9 +-------- wcsmbs/isoc99_wscanf.c | 7 +------ 6 files changed, 6 insertions(+), 32 deletions(-) (limited to 'wcsmbs') diff --git a/wcsmbs/isoc99_fwscanf.c b/wcsmbs/isoc99_fwscanf.c index 00b07dd..5829607 100644 --- a/wcsmbs/isoc99_fwscanf.c +++ b/wcsmbs/isoc99_fwscanf.c @@ -21,20 +21,15 @@ #include /* Read formatted input from STREAM according to the format string FORMAT. */ -/* VARARGS2 */ int __isoc99_fwscanf (FILE *stream, const wchar_t *format, ...) { va_list arg; int done; - _IO_acquire_lock_clear_flags2 (stream); - stream->_flags2 |= _IO_FLAGS2_SCANF_STD; - va_start (arg, format); - done = __vfwscanf_internal (stream, format, arg, 0); + done = __vfwscanf_internal (stream, format, arg, SCANF_ISOC99_A); va_end (arg); - _IO_release_lock (stream); return done; } diff --git a/wcsmbs/isoc99_swscanf.c b/wcsmbs/isoc99_swscanf.c index 40401d0..f90e56d 100644 --- a/wcsmbs/isoc99_swscanf.c +++ b/wcsmbs/isoc99_swscanf.c @@ -28,10 +28,9 @@ __isoc99_swscanf (const wchar_t *s, const wchar_t *format, ...) _IO_strfile sf; struct _IO_wide_data wd; FILE *f = _IO_strfile_readw (&sf, &wd, s); - f->_flags2 |= _IO_FLAGS2_SCANF_STD; va_start (arg, format); - done = __vfwscanf_internal (f, format, arg, 0); + done = __vfwscanf_internal (f, format, arg, SCANF_ISOC99_A); va_end (arg); return done; diff --git a/wcsmbs/isoc99_vfwscanf.c b/wcsmbs/isoc99_vfwscanf.c index f70c6b5..715d354 100644 --- a/wcsmbs/isoc99_vfwscanf.c +++ b/wcsmbs/isoc99_vfwscanf.c @@ -20,16 +20,9 @@ #include /* Read formatted input from STREAM according to the format string FORMAT. */ -/* VARARGS2 */ int __isoc99_vfwscanf (FILE *stream, const wchar_t *format, va_list args) { - int done; - - _IO_acquire_lock_clear_flags2 (stream); - stream->_flags2 |= _IO_FLAGS2_SCANF_STD; - done = __vfwscanf_internal (stream, format, args, 0); - _IO_release_lock (stream); - return done; + return __vfwscanf_internal (stream, format, args, SCANF_ISOC99_A); } libc_hidden_def (__isoc99_vfwscanf) diff --git a/wcsmbs/isoc99_vswscanf.c b/wcsmbs/isoc99_vswscanf.c index b91eb65..0d8ef76 100644 --- a/wcsmbs/isoc99_vswscanf.c +++ b/wcsmbs/isoc99_vswscanf.c @@ -33,7 +33,6 @@ __isoc99_vswscanf (const wchar_t *string, const wchar_t *format, va_list args) _IO_strfile sf; struct _IO_wide_data wd; FILE *f = _IO_strfile_readw (&sf, &wd, string); - f->_flags2 |= _IO_FLAGS2_SCANF_STD; - return __vfwscanf_internal (f, format, args, 0); + return __vfwscanf_internal (f, format, args, SCANF_ISOC99_A); } libc_hidden_def (__isoc99_vswscanf) diff --git a/wcsmbs/isoc99_vwscanf.c b/wcsmbs/isoc99_vwscanf.c index eb22c8a..3ac3182 100644 --- a/wcsmbs/isoc99_vwscanf.c +++ b/wcsmbs/isoc99_vwscanf.c @@ -20,15 +20,8 @@ #include /* Read formatted input from STDIN according to the format string FORMAT. */ -/* VARARGS2 */ int __isoc99_vwscanf (const wchar_t *format, va_list args) { - int done; - - _IO_acquire_lock_clear_flags2 (stdin); - stdin->_flags2 |= _IO_FLAGS2_SCANF_STD; - done = __vfwscanf_internal (stdin, format, args, 0); - _IO_release_lock (stdin); - return done; + return __vfwscanf_internal (stdin, format, args, SCANF_ISOC99_A); } diff --git a/wcsmbs/isoc99_wscanf.c b/wcsmbs/isoc99_wscanf.c index 59f80d7..b9418f7 100644 --- a/wcsmbs/isoc99_wscanf.c +++ b/wcsmbs/isoc99_wscanf.c @@ -22,20 +22,15 @@ /* Read formatted input from stdin according to the format string FORMAT. */ -/* VARARGS1 */ int __isoc99_wscanf (const wchar_t *format, ...) { va_list arg; int done; - _IO_acquire_lock_clear_flags2 (stdin); - stdin->_flags2 |= _IO_FLAGS2_SCANF_STD; - va_start (arg, format); - done = __vfwscanf_internal (stdin, format, arg, 0); + done = __vfwscanf_internal (stdin, format, arg, SCANF_ISOC99_A); va_end (arg); - _IO_release_lock (stdin); return done; } -- cgit v1.1