public inbox for glibc-cvs@sourceware.org help / color / mirror / Atom feed
From: Florian Weimer <fw@sourceware.org> To: glibc-cvs@sourceware.org Subject: [glibc] __printf_fphex always uses LC_NUMERIC Date: Mon, 23 May 2022 09:08:30 +0000 (GMT) [thread overview] Message-ID: <20220523090830.B08D2383A311@sourceware.org> (raw) https://sourceware.org/git/gitweb.cgi?p=glibc.git;h=b094c52b1b65693368d0d70c505e0d0b4edad1c2 commit b094c52b1b65693368d0d70c505e0d0b4edad1c2 Author: Florian Weimer <fweimer@redhat.com> Date: Mon May 23 10:08:18 2022 +0200 __printf_fphex always uses LC_NUMERIC There is no hexadecimal currency printing. strfmon uses __printf_fp_l exclusively. Reviewed-by: Adhemerval Zanella <adhemerval.zanella@linaro.org> Diff: --- stdio-common/printf_fphex.c | 30 +++++++++++------------------- 1 file changed, 11 insertions(+), 19 deletions(-) diff --git a/stdio-common/printf_fphex.c b/stdio-common/printf_fphex.c index 3dbbefd972..5af380da62 100644 --- a/stdio-common/printf_fphex.c +++ b/stdio-common/printf_fphex.c @@ -103,9 +103,17 @@ __printf_fphex (FILE *fp, } fpnum; - /* Locale-dependent representation of decimal point. */ - const char *decimal; - wchar_t decimalwc; + /* This function always uses LC_NUMERIC. */ + assert (info->extra == 0); + + /* Locale-dependent representation of decimal point. Hexadecimal + formatting always using LC_NUMERIC (disregarding info->extra). */ + const char *decimal = _NL_CURRENT (LC_NUMERIC, DECIMAL_POINT); + wchar_t decimalwc = _NL_CURRENT_WORD (LC_NUMERIC, + _NL_NUMERIC_DECIMAL_POINT_WC); + + /* The decimal point character must never be zero. */ + assert (*decimal != '\0' && decimalwc != L'\0'); /* "NaN" or "Inf" for the special cases. */ const char *special = NULL; @@ -147,22 +155,6 @@ __printf_fphex (FILE *fp, /* Nonzero if this is output on a wide character stream. */ int wide = info->wide; - - /* Figure out the decimal point character. */ - if (info->extra == 0) - { - decimal = _NL_CURRENT (LC_NUMERIC, DECIMAL_POINT); - decimalwc = _NL_CURRENT_WORD (LC_NUMERIC, _NL_NUMERIC_DECIMAL_POINT_WC); - } - else - { - decimal = _NL_CURRENT (LC_MONETARY, MON_DECIMAL_POINT); - decimalwc = _NL_CURRENT_WORD (LC_MONETARY, - _NL_MONETARY_DECIMAL_POINT_WC); - } - /* The decimal point character must never be zero. */ - assert (*decimal != '\0' && decimalwc != L'\0'); - #define PRINTF_FPHEX_FETCH(FLOAT, VAR) \ { \ (VAR) = *(const FLOAT *) args[0]; \
reply other threads:[~2022-05-23 9:08 UTC|newest] Thread overview: [no followups] expand[flat|nested] mbox.gz Atom feed
Reply instructions: You may reply publicly to this message via plain-text email using any one of the following methods: * Save the following mbox file, import it into your mail client, and reply-to-all from there: mbox Avoid top-posting and favor interleaved quoting: https://en.wikipedia.org/wiki/Posting_style#Interleaved_style * Reply using the --to, --cc, and --in-reply-to switches of git-send-email(1): git send-email \ --in-reply-to=20220523090830.B08D2383A311@sourceware.org \ --to=fw@sourceware.org \ --cc=glibc-cvs@sourceware.org \ /path/to/YOUR_REPLY https://kernel.org/pub/software/scm/git/docs/git-send-email.html * If your mail client supports setting the In-Reply-To header via mailto: links, try the mailto: linkBe sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions for how to clone and mirror all data and code used for this inbox; as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).