Sync with gnulib 64ddc975e72cb55d2b2d755c25603bd70312aa5e:
This patch alters xstrtoumax behavior slightly, in areas are not
likely to affect any real callers, by making xstrtoumax behave more
like the system strtol. In particular, it lets xstrtoumax support
bases other than those required by POSIX, if the underlying
implementation does; this removes the need for an g_assert().
* lib/strutil/strtol.c: Do not include stdio.h.
(xstrtoumax): Use same parameter names as POSIX, to make it
easier for outsiders to follow. Do not require the base to be 0-36,
as the underlying implementation is allowed to support other bases.
Sync with gnulib 16b33e6649425fcdce095f262da98b539d2f7448.
* (xstrtoumax): Don't update *endptr if strtol doesn't.
Also, if the underlying strtol gives an unusual error number and
sets *endpnr = nptr, assume that's an error not a missing number.
Sync with gnulib bd1e981434c98751b1106a1744e77a27317b52b3
* (xstrtoumax): Stop worrying about hypothetical implementations that
are causing more confusion than the code is worth. Instead, go back
more to old way of doing things. None of this matters for practical
applications.
Add commemt.
Signed-off-by: Andrew Borodin <aborodin@vmail.ru>
As voted for in Nov 2022 by the BIPM:
https://www.bipm.org/en/cgpm-2022/resolution-3
Sync with gnulib 0ad3ea4951f77835d02180021589f3a849d885f2.
Signed-off-by: Andrew Borodin <aborodin@vmail.ru>
lib/strutil/xstrtol.c: prohibit monstrosities like "1bB".
Problem reported by Young Mo Kang in: http://bugs.gnu.org/23388.
(xstrtoumax): Allow trailing second suffixes like "B" only if the first
suffix needs a base.
Signed-off-by: Andrew Borodin <aborodin@vmail.ru>
Introduce -Wswitch-default check.
Some minor cosmetics.
Thanks Andreas Mohr <and at gmx dot li> for original patch.
Signed-off-by: Andrew Borodin <aborodin@vmail.ru>