- 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
ef527f85f2
commit
043ed1f581
@ -48,9 +48,9 @@ __BEGIN_DECLS
|
||||
intmax_t imaxabs(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. */
|
||||
intmax_t strtoimax(const char *, char **, int);
|
||||
uintmax_t strtoumax(const char *, char **, int);
|
||||
intmax_t wcstoimax(const wchar_t *, wchar_t **, int);
|
||||
uintmax_t wcstoumax(const wchar_t *, wchar_t **, int);
|
||||
__END_DECLS
|
||||
|
@ -114,10 +114,10 @@ void qsort(void *, size_t, size_t,
|
||||
int rand(void);
|
||||
void *realloc(void *, size_t);
|
||||
void srand(unsigned);
|
||||
double strtod(const char *, char **);
|
||||
long strtol(const char *, char **, int);
|
||||
double strtod(const char *__restrict, char **__restrict);
|
||||
long strtol(const char *__restrict, char **__restrict, int);
|
||||
unsigned long
|
||||
strtoul(const char *, char **, int);
|
||||
strtoul(const char *__restrict, char **__restrict, int);
|
||||
int system(const char *);
|
||||
|
||||
int mblen(const char *, size_t);
|
||||
@ -198,13 +198,13 @@ void srandomdev(void);
|
||||
#ifdef __LONG_LONG_SUPPORTED
|
||||
/* LONGLONG */
|
||||
long long
|
||||
strtoll(const char *, char **, int);
|
||||
strtoll(const char *__restrict, char **__restrict, int);
|
||||
#endif
|
||||
__int64_t strtoq(const char *, char **, int);
|
||||
#ifdef __LONG_LONG_SUPPORTED
|
||||
/* LONGLONG */
|
||||
unsigned long long
|
||||
strtoull(const char *, char **, int);
|
||||
strtoull(const char *__restrict, char **__restrict, int);
|
||||
#endif
|
||||
__uint64_t
|
||||
strtouq(const char *, char **, int);
|
||||
|
@ -49,7 +49,7 @@ string to double
|
||||
.Sh SYNOPSIS
|
||||
.In stdlib.h
|
||||
.Ft double
|
||||
.Fn strtod "const char *nptr" "char **endptr"
|
||||
.Fn strtod "const char *restrict nptr" "char **restrict endptr"
|
||||
.Sh DESCRIPTION
|
||||
The
|
||||
.Fn strtod
|
||||
|
@ -1191,9 +1191,9 @@ static double tinytens[] = { 1e-16, 1e-32 };
|
||||
double
|
||||
strtod
|
||||
#ifdef KR_headers
|
||||
(s00, se) CONST char *s00; char **se;
|
||||
(s00, se) CONST char *__restrict s00; char **__restrict se;
|
||||
#else
|
||||
(CONST char *s00, char **se)
|
||||
(CONST char *__restrict s00, char **__restrict se)
|
||||
#endif
|
||||
{
|
||||
int bb2, bb5, bbe, bd2, bd5, bbbits, bs2, c, dsign,
|
||||
|
@ -49,10 +49,7 @@ __FBSDID("$FreeBSD$");
|
||||
* alphabets and digits are each contiguous.
|
||||
*/
|
||||
intmax_t
|
||||
strtoimax(nptr, endptr, base)
|
||||
const char *nptr;
|
||||
char **endptr;
|
||||
int base;
|
||||
strtoimax(const char *__restrict nptr, char **__restrict endptr, int base)
|
||||
{
|
||||
const char *s;
|
||||
uintmax_t acc;
|
||||
|
@ -52,12 +52,12 @@ integer
|
||||
.In stdlib.h
|
||||
.In limits.h
|
||||
.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
|
||||
.Fn strtoll "const char *nptr" "char **endptr" "int base"
|
||||
.Fn strtoll "const char *restrict nptr" "char **restrict endptr" "int base"
|
||||
.In inttypes.h
|
||||
.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 stdlib.h
|
||||
.In limits.h
|
||||
|
@ -50,10 +50,7 @@ __FBSDID("$FreeBSD$");
|
||||
* alphabets and digits are each contiguous.
|
||||
*/
|
||||
long
|
||||
strtol(nptr, endptr, base)
|
||||
const char *nptr;
|
||||
char **endptr;
|
||||
int base;
|
||||
strtol(const char *__restrict nptr, char **__restrict endptr, int base)
|
||||
{
|
||||
const char *s;
|
||||
unsigned long acc;
|
||||
|
@ -49,10 +49,7 @@ __FBSDID("$FreeBSD$");
|
||||
* alphabets and digits are each contiguous.
|
||||
*/
|
||||
long long
|
||||
strtoll(nptr, endptr, base)
|
||||
const char *nptr;
|
||||
char **endptr;
|
||||
int base;
|
||||
strtoll(const char *__restrict nptr, char **__restrict endptr, int base)
|
||||
{
|
||||
const char *s;
|
||||
unsigned long long acc;
|
||||
|
@ -45,10 +45,7 @@ __FBSDID("$FreeBSD$");
|
||||
* Convert a string to a quad integer.
|
||||
*/
|
||||
quad_t
|
||||
strtoq(nptr, endptr, base)
|
||||
const char *nptr;
|
||||
char **endptr;
|
||||
int base;
|
||||
strtoq(const char *nptr, char **endptr, int base)
|
||||
{
|
||||
|
||||
return strtoll(nptr, endptr, base);
|
||||
|
@ -52,12 +52,12 @@ integer
|
||||
.In stdlib.h
|
||||
.In limits.h
|
||||
.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"
|
||||
.Fn strtoull "const char *nptr" "char **endptr" "int base"
|
||||
.Fn strtoull "const char *restrict nptr" "char **restrict endptr" "int base"
|
||||
.In inttypes.h
|
||||
.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 stdlib.h
|
||||
.In limits.h
|
||||
|
@ -49,10 +49,7 @@ __FBSDID("$FreeBSD$");
|
||||
* alphabets and digits are each contiguous.
|
||||
*/
|
||||
unsigned long
|
||||
strtoul(nptr, endptr, base)
|
||||
const char *nptr;
|
||||
char **endptr;
|
||||
int base;
|
||||
strtoul(const char *__restrict nptr, char **__restrict endptr, int base)
|
||||
{
|
||||
const char *s;
|
||||
unsigned long acc;
|
||||
|
@ -49,10 +49,7 @@ __FBSDID("$FreeBSD$");
|
||||
* alphabets and digits are each contiguous.
|
||||
*/
|
||||
unsigned long long
|
||||
strtoull(nptr, endptr, base)
|
||||
const char *nptr;
|
||||
char **endptr;
|
||||
int base;
|
||||
strtoull(const char *__restrict nptr, char **__restrict endptr, int base)
|
||||
{
|
||||
const char *s;
|
||||
unsigned long long acc;
|
||||
|
@ -49,10 +49,7 @@ __FBSDID("$FreeBSD$");
|
||||
* alphabets and digits are each contiguous.
|
||||
*/
|
||||
uintmax_t
|
||||
strtoumax(nptr, endptr, base)
|
||||
const char *nptr;
|
||||
char **endptr;
|
||||
int base;
|
||||
strtoumax(const char *__restrict nptr, char **__restrict endptr, int base)
|
||||
{
|
||||
const char *s;
|
||||
uintmax_t acc;
|
||||
|
@ -45,10 +45,7 @@ __FBSDID("$FreeBSD$");
|
||||
* Convert a string to an unsigned quad integer.
|
||||
*/
|
||||
u_quad_t
|
||||
strtouq(nptr, endptr, base)
|
||||
const char *nptr;
|
||||
char **endptr;
|
||||
int base;
|
||||
strtouq(const char *nptr, char **endptr, int base)
|
||||
{
|
||||
|
||||
return strtoull(nptr, endptr, base);
|
||||
|
Loading…
x
Reference in New Issue
Block a user