]> Savannah Git Hosting - gnulib.git/commit
xstrtol: document and stray less from strtol
authorPaul Eggert <eggert@cs.ucla.edu>
Fri, 19 Jul 2024 00:28:36 +0000 (17:28 -0700)
committerPaul Eggert <eggert@cs.ucla.edu>
Fri, 19 Jul 2024 00:30:02 +0000 (17:30 -0700)
commit64ddc975e72cb55d2b2d755c25603bd70312aa5e
treec380916c54d5d3fefed777b6a58e364e73422582
parent61d3e9ea6445164053f863060906414a86e391ce
xstrtol: document and stray less from strtol

This patch alters xstrtol behavior slightly, in areas are not
likely to affect any real callers, by making xstrtol behave more
like the system strtol.  In particular, it lets xstrtol support
bases other than those required by POSIX, if the underlying
implementation does; this removes the need for an ‘assert’.
It also uses ‘restrict’ like the underlying strtol does.
The patch also documents xstrtol in xstrtol.h.
Problems reported by AlejandroColomar in:
https://lists.gnu.org/r/bug-gnulib/2024-07/msg00159.html
* lib/xstrtol.c: Do not include stdio.h or assure.h.
(__xstrtol): Use same parameter names as POSIX, to make it
easier for outsiders to follow.  Assume C99 decls after statement.
Do not require the base to be 0, or 2-36, as the underlying
implementation is allowed to support other bases.
Do not assume isspace preserves errno.
* lib/xstrtol.h (_DECLARE_XSTRTOL): Declare pointers to be
‘restrict’, for compatibility with C.
* m4/xstrtol.m4 (gl_XSTRTOL): Require AC_C_RESTRICT.
* modules/xstrtol (Depends-on): Remove ‘assure’.
ChangeLog
lib/xstrtol.c
lib/xstrtol.h
m4/xstrtol.m4
modules/xstrtol