diff options
author | Gabriel F. T. Gomes <gabrielftg@linux.ibm.com> | 2019-07-11 11:47:47 -0300 |
---|---|---|
committer | Gabriel F. T. Gomes <gabrielftg@linux.ibm.com> | 2019-11-27 15:52:41 -0300 |
commit | 590ef889bc7afe42d4feec94e1c4fbd4ddd65226 (patch) | |
tree | 73fa4b5f39f63a91c8232df0789b36716fffc075 /sysdeps/ieee754/ldbl-128ibm-compat/ieee128-obstack_chk.c | |
parent | ff3cb5accb80471df69fac2c0dded9cab794220a (diff) | |
download | glibc-590ef889bc7afe42d4feec94e1c4fbd4ddd65226.zip glibc-590ef889bc7afe42d4feec94e1c4fbd4ddd65226.tar.gz glibc-590ef889bc7afe42d4feec94e1c4fbd4ddd65226.tar.bz2 |
ldbl-128ibm-compat: Add obstack printing functions
Similarly to the functions from the *printf family, this patch adds
implementations for __obstack_*printf* functions that set the
'mode_flags' parameter to PRINTF_LDBL_USES_FLOAT128, before making calls
to __vfprintf_internal (indirectly through __obstack_vprintf_internal).
Tested for powerpc64le.
Reviewed-by: Paul E. Murphy <murphyp@linux.ibm.com>
Diffstat (limited to 'sysdeps/ieee754/ldbl-128ibm-compat/ieee128-obstack_chk.c')
-rw-r--r-- | sysdeps/ieee754/ldbl-128ibm-compat/ieee128-obstack_chk.c | 39 |
1 files changed, 39 insertions, 0 deletions
diff --git a/sysdeps/ieee754/ldbl-128ibm-compat/ieee128-obstack_chk.c b/sysdeps/ieee754/ldbl-128ibm-compat/ieee128-obstack_chk.c new file mode 100644 index 0000000..0bbdf0d --- /dev/null +++ b/sysdeps/ieee754/ldbl-128ibm-compat/ieee128-obstack_chk.c @@ -0,0 +1,39 @@ +/* Wrapper for __obstack_printf_chk. IEEE128 version. + Copyright (C) 2019 Free Software Foundation, Inc. + This file is part of the GNU C Library. + + The GNU C Library is free software; you can redistribute it and/or + modify it under the terms of the GNU Lesser General Public + License as published by the Free Software Foundation; either + version 2.1 of the License, or (at your option) any later version. + + The GNU C Library is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser General Public + License along with the GNU C Library; if not, see + <http://www.gnu.org/licenses/>. */ + +#include <stdarg.h> +#include <libio/libioP.h> + +extern int +___ieee128_obstack_printf_chk (struct obstack *obstack, int flag, + const char *format, ...) +{ + va_list ap; + int done; + + unsigned int mode = PRINTF_LDBL_USES_FLOAT128; + if (flag > 0) + mode |= PRINTF_FORTIFY; + + va_start (ap, format); + done = __obstack_vprintf_internal (obstack, format, ap, mode); + va_end (ap); + + return done; +} +strong_alias (___ieee128_obstack_printf_chk, __obstack_printf_chkieee128) |