mailing list of musl libc
 help / color / mirror / code / Atom feed
From: Andrei Vagin <avagin@virtuozzo.com>
To: musl@lists.openwall.com
Cc: Andrei Vagin <avagin@virtuozzo.com>
Subject: [PATCH] printf: handle the L modifier for integers
Date: Fri,  1 Jun 2018 00:56:55 +0300	[thread overview]
Message-ID: <20180531215655.6662-1-avagin@virtuozzo.com> (raw)

The L modifier is usually used for floating-point numbers, but
glibc allows to use this modifier for integers too.

I think here is nothing wrong if we will be compatible with glibc here.

It is not often when a error code of printf is checked, so we may have
a situation when a code works with glibc and doesn't work with musl.

Signed-off-by: Andrei Vagin <avagin@virtuozzo.com>
---
 src/stdio/vfprintf.c  | 3 +++
 src/stdio/vfwprintf.c | 3 +++
 2 files changed, 6 insertions(+)

diff --git a/src/stdio/vfprintf.c b/src/stdio/vfprintf.c
index 50fb55c1..7f6c4f39 100644
--- a/src/stdio/vfprintf.c
+++ b/src/stdio/vfprintf.c
@@ -82,6 +82,9 @@ static const unsigned char states[]['z'-'A'+1] = {
 	}, { /* 5: L-prefixed */
 		S('e') = LDBL, S('f') = LDBL, S('g') = LDBL, S('a') = LDBL,
 		S('E') = LDBL, S('F') = LDBL, S('G') = LDBL, S('A') = LDBL,
+		S('d') = LLONG, S('i') = LLONG,
+		S('o') = ULLONG, S('u') = ULLONG,
+		S('x') = ULLONG, S('X') = ULLONG,
 		S('n') = PTR,
 	}, { /* 6: z- or t-prefixed (assumed to be same size) */
 		S('d') = PDIFF, S('i') = PDIFF,
diff --git a/src/stdio/vfwprintf.c b/src/stdio/vfwprintf.c
index e87ad42a..c6ce82ea 100644
--- a/src/stdio/vfwprintf.c
+++ b/src/stdio/vfwprintf.c
@@ -73,6 +73,9 @@ static const unsigned char states[]['z'-'A'+1] = {
 	}, { /* 5: L-prefixed */
 		S('e') = LDBL, S('f') = LDBL, S('g') = LDBL, S('a') = LDBL,
 		S('E') = LDBL, S('F') = LDBL, S('G') = LDBL, S('A') = LDBL,
+		S('d') = LLONG, S('i') = LLONG,
+		S('o') = ULLONG, S('u') = ULLONG,
+		S('x') = ULLONG, S('X') = ULLONG,
 		S('n') = PTR,
 	}, { /* 6: z- or t-prefixed (assumed to be same size) */
 		S('d') = PDIFF, S('i') = PDIFF,
-- 
2.14.3



             reply	other threads:[~2018-05-31 21:56 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-05-31 21:56 Andrei Vagin [this message]
2018-06-01  6:01 ` Markus Wichmann

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=20180531215655.6662-1-avagin@virtuozzo.com \
    --to=avagin@virtuozzo.com \
    --cc=musl@lists.openwall.com \
    /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: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this public inbox

	https://git.vuxu.org/mirror/musl/

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 NNTP newsgroup(s).