summaryrefslogtreecommitdiff
path: root/stdio-common/_itoa.c
diff options
context:
space:
mode:
authorZack Weinberg <zackw@panix.com>2018-03-02 19:52:22 -0500
committerZack Weinberg <zackw@panix.com>2018-05-31 21:27:16 -0400
commit7f1c56e9fe6fdb7ada839b7306b094a4201083d8 (patch)
tree229677923465bf840bdfdad03736f87214ef0f31 /stdio-common/_itoa.c
parent6efff650203b78a2913c9e3dad126c5630ff84ac (diff)
downloadglibc-7f1c56e9fe6fdb7ada839b7306b094a4201083d8.tar.gz
Add __vfscanf_internal and __vfwscanf_internal with flags arguments.
There are two flags currently defined: SCANF_LDBL_IS_DBL is the mode used by __nldbl_ scanf variants, and SCANF_ISOC99_A is the mode used by __isoc99_ scanf variants. In this patch, the new functions honor these flag bits if they're set, but they still also look at the corresponding bits of environmental state, and callers all pass zero. The new functions do *not* have the "errp" argument possessed by _IO_vfscanf and _IO_vfwscanf. All internal callers passed NULL for that argument. External callers could theoretically exist, so I preserved wrappers, but they are flagged as compat symbols and they don't preserve the three-way distinction among types of errors that was formerly exposed. These functions probably should have been in the list of deprecated _IO_ symbols in 2.27 NEWS -- they're not just aliases for vfscanf and vfwscanf. (It was necessary to introduce ldbl_compat_symbol for _IO_vfscanf. Please check that part of the patch very carefully, I am still not confident I understand all of the details of ldbl-opt.) This patch also introduces helper inlines in libio/strfile.h that encapsulate the process of initializing an _IO_strfile object for reading. This allows us to call __vfscanf_internal directly from sscanf, and __vfwscanf_internal directly from swscanf, without duplicating the initialization code. (Previously, they called their v-counterparts, but that won't work if we want to control *both* C99 mode and ldbl-is-dbl mode using the flags argument to __vfscanf_internal.) It's still a little awkward, especially for wide strfiles, but it's much better than what we had. * libio/libioP.h (SCANF_LDBL_IS_DBL, SCANF_ISOC99_A): New constants. (__vfscanf_internal, __vfwscanf_internal): New function prototypes. * libio/libio.h: Remove libc_hidden_proto for _IO_vfscanf. * libio/strfile.h: Add multiple inclusion guard. (_IO_strfile_read, _IO_strfile_readw): New inline functions. * sysdeps/generic/math_ldbl_opt.h: Include shlib-compat.h, for consistency with the other version of this file. (ldbl_compat_symbol): New macro. * sysdeps/ieee754/ldbl-opt/math_ldbl_opt.h (ldbl_compat_symbol): New macro. * stdio-common/vfscanf-internal.c: Rename from vfscanf.c. Define __vfscanf_internal or __vfwscanf_internal, depending on COMPILE_WPRINTF; don't define any other public symbols. Temporarily check __ldbl_is_dbl and _IO_FLAGS2_SCANF_STD as well as the mode_flags argument. (encode_error, conv_error, input_error): Don't set errval. * stdio-common/vfwscanf-internal.c: Rename from vfwscanf.c. Include vfscanf-internal.c. * stdio-common/vfscanf.c, stdio-common/vfwscanf.c: New files defining the public entry points vfscanf and vfwscanf respectively. * stdio-common/iovfscanf.c, stdio-common/iovfwscanf.c: New files defining the compat symbols _IO_vfscanf and _IO_vfwscanf respectively. * stdio-common/Makefile (routines): Add vfscanf-internal, vfwscanf-internal, iovfscanf, iovfwscanf. * stdio-common/Versions: Mention GLIBC_2.28, so that it can be used in SHLIB_COMPAT expressions. * sysdeps/ieee754/ldbl-opt/nldbl-compat.c (__nldbl__IO_vfscanf): Wrap definition and compat_symbol line in #if SHLIB_COMPAT. * libio/iovsscanf.c, libio/vscanf.c, libio/vwscanf.c, libio/wscanf.c * libio/iovswscanf.c, stdio-common/isoc99_fscanf.c * stdio-common/isoc99_scanf.c, stdio-common/isoc99_vfscanf.c * stdio-common/isoc99_vscanf.c, stdio-common/isoc99_vsscanf.c * stdio-common/scanf.c, sysdeps/ieee754/ldbl-opt/nldbl-compat.c * wcsmbs/isoc99_fwscanf.c, wcsmbs/isoc99_vfwscanf.c * wcsmbs/isoc99_vswscanf.c, wcsmbs/isoc99_vwscanf.c * wcsmbs/isoc99_wscanf.c: Use __vfscanf_internal instead of _IO_vfscanf, and/or __vfwscanf_internal instead of _IO_vfwscanf. * libio/iovsscanf.c, stdio-common/isoc99_vsscanf.c: Use _IO_strfile_read. Clean up includes. * stdio-common/sscanf.c, stdio-common/isoc99_sscanf.c: Use _IO_strfile_read to set up a FILE, and then call __vfwcanf_internal directly. Clean up includes. * libio/iovswscanf.c, wcsmbs/isoc99_vswscanf.c: Use _IO_strfile_readw. Clean up includes. * libio/swscanf.c, wcsmbs/isoc99_swscanf.c: Use _IO_strfile_readw to set up a FILE, and then call __vfwscanf_internal directly. Clean up includes.
Diffstat (limited to 'stdio-common/_itoa.c')
0 files changed, 0 insertions, 0 deletions