Remove duplicated code from __printf_fp_l, __printf_fphex, and __printf_size
commitaab0f374e7c43f6baf88db271865feabb7bcc1b2
authorGabriel F. T. Gomes <gftg@linux.vnet.ibm.com>
Mon, 29 May 2017 13:49:42 +0000 (29 10:49 -0300)
committerGabriel F. T. Gomes <gftg@linux.vnet.ibm.com>
Wed, 7 Jun 2017 20:04:58 +0000 (7 17:04 -0300)
tree4a83a72039818f7eea6942062462b2f9149e7d9d
parent32bf1d09dadee5b60df869ed3567a2b12c04e3fc
Remove duplicated code from __printf_fp_l, __printf_fphex, and __printf_size

In __printf_fp_l, __printf_fphex, and __printf_size the blocks of code that are
used to read a double or long double argument, check for special values and
convert to multiprecision are similar.  When adding float128 support to libc,
more code would be duplicated to deal with the extra type.  This patch moves
the repetitive code to a macro which is now used by double and long double and
will be used for float128 when support is added, thus avoiding more
duplication.

Tested for powerpc64le and s390x.

* stdio-common/printf_fp.c (PRINTF_FP_FETCH): New macro.
(__printf_fp_l): Use the new macro to avoid duplicating code.
* stdio-common/printf_fphex.c (PRINTF_FPHEX_FETCH): New macro.
(__printf_fphex): Use the new macro to avoid duplicating code.
* stdio-common/printf_size.c (PRINTF_SIZE_FETCH): New macro.
(__printf_size): Use the new macro to avoid duplicating code.
ChangeLog
stdio-common/printf_fp.c
stdio-common/printf_fphex.c
stdio-common/printf_size.c