- Add the 'restrict' qualifier to the function prototypes and
definitions of the functions that convert strings to numbers and are defined by IEEE Std 1003-1.2001. - Use ANSI-C function definitions for all of the functions mentioned above plus strtouq and strtoq. - Update the prototypes in the manual pages.
This commit is contained in:
parent
0d533e437d
commit
5618f72405
Notes:
svn2git
2020-12-20 02:59:44 +00:00
svn path=/head/; revision=101912
@ -48,9 +48,9 @@ __BEGIN_DECLS
|
|||||||
intmax_t imaxabs(intmax_t) __pure2;
|
intmax_t imaxabs(intmax_t) __pure2;
|
||||||
imaxdiv_t imaxdiv(intmax_t, intmax_t) __pure2;
|
imaxdiv_t imaxdiv(intmax_t, intmax_t) __pure2;
|
||||||
|
|
||||||
|
intmax_t strtoimax(const char *__restrict, char **__restrict, int);
|
||||||
|
uintmax_t strtoumax(const char *__restrict, char **__restrict, int);
|
||||||
/* XXX: The following functions are missing the restrict type qualifier. */
|
/* XXX: The following functions are missing the restrict type qualifier. */
|
||||||
intmax_t strtoimax(const char *, char **, int);
|
|
||||||
uintmax_t strtoumax(const char *, char **, int);
|
|
||||||
intmax_t wcstoimax(const wchar_t *, wchar_t **, int);
|
intmax_t wcstoimax(const wchar_t *, wchar_t **, int);
|
||||||
uintmax_t wcstoumax(const wchar_t *, wchar_t **, int);
|
uintmax_t wcstoumax(const wchar_t *, wchar_t **, int);
|
||||||
__END_DECLS
|
__END_DECLS
|
||||||
|
@ -114,10 +114,10 @@ void qsort(void *, size_t, size_t,
|
|||||||
int rand(void);
|
int rand(void);
|
||||||
void *realloc(void *, size_t);
|
void *realloc(void *, size_t);
|
||||||
void srand(unsigned);
|
void srand(unsigned);
|
||||||
double strtod(const char *, char **);
|
double strtod(const char *__restrict, char **__restrict);
|
||||||
long strtol(const char *, char **, int);
|
long strtol(const char *__restrict, char **__restrict, int);
|
||||||
unsigned long
|
unsigned long
|
||||||
strtoul(const char *, char **, int);
|
strtoul(const char *__restrict, char **__restrict, int);
|
||||||
int system(const char *);
|
int system(const char *);
|
||||||
|
|
||||||
int mblen(const char *, size_t);
|
int mblen(const char *, size_t);
|
||||||
@ -198,13 +198,13 @@ void srandomdev(void);
|
|||||||
#ifdef __LONG_LONG_SUPPORTED
|
#ifdef __LONG_LONG_SUPPORTED
|
||||||
/* LONGLONG */
|
/* LONGLONG */
|
||||||
long long
|
long long
|
||||||
strtoll(const char *, char **, int);
|
strtoll(const char *__restrict, char **__restrict, int);
|
||||||
#endif
|
#endif
|
||||||
__int64_t strtoq(const char *, char **, int);
|
__int64_t strtoq(const char *, char **, int);
|
||||||
#ifdef __LONG_LONG_SUPPORTED
|
#ifdef __LONG_LONG_SUPPORTED
|
||||||
/* LONGLONG */
|
/* LONGLONG */
|
||||||
unsigned long long
|
unsigned long long
|
||||||
strtoull(const char *, char **, int);
|
strtoull(const char *__restrict, char **__restrict, int);
|
||||||
#endif
|
#endif
|
||||||
__uint64_t
|
__uint64_t
|
||||||
strtouq(const char *, char **, int);
|
strtouq(const char *, char **, int);
|
||||||
|
@ -49,7 +49,7 @@ string to double
|
|||||||
.Sh SYNOPSIS
|
.Sh SYNOPSIS
|
||||||
.In stdlib.h
|
.In stdlib.h
|
||||||
.Ft double
|
.Ft double
|
||||||
.Fn strtod "const char *nptr" "char **endptr"
|
.Fn strtod "const char *restrict nptr" "char **restrict endptr"
|
||||||
.Sh DESCRIPTION
|
.Sh DESCRIPTION
|
||||||
The
|
The
|
||||||
.Fn strtod
|
.Fn strtod
|
||||||
|
@ -1191,9 +1191,9 @@ static double tinytens[] = { 1e-16, 1e-32 };
|
|||||||
double
|
double
|
||||||
strtod
|
strtod
|
||||||
#ifdef KR_headers
|
#ifdef KR_headers
|
||||||
(s00, se) CONST char *s00; char **se;
|
(s00, se) CONST char *__restrict s00; char **__restrict se;
|
||||||
#else
|
#else
|
||||||
(CONST char *s00, char **se)
|
(CONST char *__restrict s00, char **__restrict se)
|
||||||
#endif
|
#endif
|
||||||
{
|
{
|
||||||
int bb2, bb5, bbe, bd2, bd5, bbbits, bs2, c, dsign,
|
int bb2, bb5, bbe, bd2, bd5, bbbits, bs2, c, dsign,
|
||||||
|
@ -49,10 +49,7 @@ __FBSDID("$FreeBSD$");
|
|||||||
* alphabets and digits are each contiguous.
|
* alphabets and digits are each contiguous.
|
||||||
*/
|
*/
|
||||||
intmax_t
|
intmax_t
|
||||||
strtoimax(nptr, endptr, base)
|
strtoimax(const char *__restrict nptr, char **__restrict endptr, int base)
|
||||||
const char *nptr;
|
|
||||||
char **endptr;
|
|
||||||
int base;
|
|
||||||
{
|
{
|
||||||
const char *s;
|
const char *s;
|
||||||
uintmax_t acc;
|
uintmax_t acc;
|
||||||
|
@ -52,12 +52,12 @@ integer
|
|||||||
.In stdlib.h
|
.In stdlib.h
|
||||||
.In limits.h
|
.In limits.h
|
||||||
.Ft long
|
.Ft long
|
||||||
.Fn strtol "const char *nptr" "char **endptr" "int base"
|
.Fn strtol "const char *restrict nptr" "char **restrict endptr" "int base"
|
||||||
.Ft long long
|
.Ft long long
|
||||||
.Fn strtoll "const char *nptr" "char **endptr" "int base"
|
.Fn strtoll "const char *restrict nptr" "char **restrict endptr" "int base"
|
||||||
.In inttypes.h
|
.In inttypes.h
|
||||||
.Ft intmax_t
|
.Ft intmax_t
|
||||||
.Fn strtoimax "const char *nptr" "char **endptr" "int base"
|
.Fn strtoimax "const char *restrict nptr" "char **restrict endptr" "int base"
|
||||||
.In sys/types.h
|
.In sys/types.h
|
||||||
.In stdlib.h
|
.In stdlib.h
|
||||||
.In limits.h
|
.In limits.h
|
||||||
|
@ -50,10 +50,7 @@ __FBSDID("$FreeBSD$");
|
|||||||
* alphabets and digits are each contiguous.
|
* alphabets and digits are each contiguous.
|
||||||
*/
|
*/
|
||||||
long
|
long
|
||||||
strtol(nptr, endptr, base)
|
strtol(const char *__restrict nptr, char **__restrict endptr, int base)
|
||||||
const char *nptr;
|
|
||||||
char **endptr;
|
|
||||||
int base;
|
|
||||||
{
|
{
|
||||||
const char *s;
|
const char *s;
|
||||||
unsigned long acc;
|
unsigned long acc;
|
||||||
|
@ -49,10 +49,7 @@ __FBSDID("$FreeBSD$");
|
|||||||
* alphabets and digits are each contiguous.
|
* alphabets and digits are each contiguous.
|
||||||
*/
|
*/
|
||||||
long long
|
long long
|
||||||
strtoll(nptr, endptr, base)
|
strtoll(const char *__restrict nptr, char **__restrict endptr, int base)
|
||||||
const char *nptr;
|
|
||||||
char **endptr;
|
|
||||||
int base;
|
|
||||||
{
|
{
|
||||||
const char *s;
|
const char *s;
|
||||||
unsigned long long acc;
|
unsigned long long acc;
|
||||||
|
@ -45,10 +45,7 @@ __FBSDID("$FreeBSD$");
|
|||||||
* Convert a string to a quad integer.
|
* Convert a string to a quad integer.
|
||||||
*/
|
*/
|
||||||
quad_t
|
quad_t
|
||||||
strtoq(nptr, endptr, base)
|
strtoq(const char *nptr, char **endptr, int base)
|
||||||
const char *nptr;
|
|
||||||
char **endptr;
|
|
||||||
int base;
|
|
||||||
{
|
{
|
||||||
|
|
||||||
return strtoll(nptr, endptr, base);
|
return strtoll(nptr, endptr, base);
|
||||||
|
@ -52,12 +52,12 @@ integer
|
|||||||
.In stdlib.h
|
.In stdlib.h
|
||||||
.In limits.h
|
.In limits.h
|
||||||
.Ft "unsigned long"
|
.Ft "unsigned long"
|
||||||
.Fn strtoul "const char *nptr" "char **endptr" "int base"
|
.Fn strtoul "const char *restrict nptr" "char **restrict endptr" "int base"
|
||||||
.Ft "unsigned long long"
|
.Ft "unsigned long long"
|
||||||
.Fn strtoull "const char *nptr" "char **endptr" "int base"
|
.Fn strtoull "const char *restrict nptr" "char **restrict endptr" "int base"
|
||||||
.In inttypes.h
|
.In inttypes.h
|
||||||
.Ft uintmax_t
|
.Ft uintmax_t
|
||||||
.Fn strtoumax "const char *nptr" "char **endptr" "int base"
|
.Fn strtoumax "const char *restrict nptr" "char **restrict endptr" "int base"
|
||||||
.In sys/types.h
|
.In sys/types.h
|
||||||
.In stdlib.h
|
.In stdlib.h
|
||||||
.In limits.h
|
.In limits.h
|
||||||
|
@ -49,10 +49,7 @@ __FBSDID("$FreeBSD$");
|
|||||||
* alphabets and digits are each contiguous.
|
* alphabets and digits are each contiguous.
|
||||||
*/
|
*/
|
||||||
unsigned long
|
unsigned long
|
||||||
strtoul(nptr, endptr, base)
|
strtoul(const char *__restrict nptr, char **__restrict endptr, int base)
|
||||||
const char *nptr;
|
|
||||||
char **endptr;
|
|
||||||
int base;
|
|
||||||
{
|
{
|
||||||
const char *s;
|
const char *s;
|
||||||
unsigned long acc;
|
unsigned long acc;
|
||||||
|
@ -49,10 +49,7 @@ __FBSDID("$FreeBSD$");
|
|||||||
* alphabets and digits are each contiguous.
|
* alphabets and digits are each contiguous.
|
||||||
*/
|
*/
|
||||||
unsigned long long
|
unsigned long long
|
||||||
strtoull(nptr, endptr, base)
|
strtoull(const char *__restrict nptr, char **__restrict endptr, int base)
|
||||||
const char *nptr;
|
|
||||||
char **endptr;
|
|
||||||
int base;
|
|
||||||
{
|
{
|
||||||
const char *s;
|
const char *s;
|
||||||
unsigned long long acc;
|
unsigned long long acc;
|
||||||
|
@ -49,10 +49,7 @@ __FBSDID("$FreeBSD$");
|
|||||||
* alphabets and digits are each contiguous.
|
* alphabets and digits are each contiguous.
|
||||||
*/
|
*/
|
||||||
uintmax_t
|
uintmax_t
|
||||||
strtoumax(nptr, endptr, base)
|
strtoumax(const char *__restrict nptr, char **__restrict endptr, int base)
|
||||||
const char *nptr;
|
|
||||||
char **endptr;
|
|
||||||
int base;
|
|
||||||
{
|
{
|
||||||
const char *s;
|
const char *s;
|
||||||
uintmax_t acc;
|
uintmax_t acc;
|
||||||
|
@ -45,10 +45,7 @@ __FBSDID("$FreeBSD$");
|
|||||||
* Convert a string to an unsigned quad integer.
|
* Convert a string to an unsigned quad integer.
|
||||||
*/
|
*/
|
||||||
u_quad_t
|
u_quad_t
|
||||||
strtouq(nptr, endptr, base)
|
strtouq(const char *nptr, char **endptr, int base)
|
||||||
const char *nptr;
|
|
||||||
char **endptr;
|
|
||||||
int base;
|
|
||||||
{
|
{
|
||||||
|
|
||||||
return strtoull(nptr, endptr, base);
|
return strtoull(nptr, endptr, base);
|
||||||
|
Loading…
Reference in New Issue
Block a user