2003-11-27 Jeff Johnston <jjohnstn@redhat.com>

* libc/include/stdlib.h (_atoll_r, _atol_r): New prototypes.
        * libc/stdlib/atol.c (_atol_r): New reentrant function.
        * libc/stdlib/atoll.c (_atoll_r): Ditto.
This commit is contained in:
Jeff Johnston 2003-11-27 20:15:47 +00:00
parent 6bbb700c34
commit 83bf7d2f89
4 changed files with 41 additions and 3 deletions

View File

@ -1,3 +1,9 @@
2003-11-27 Jeff Johnston <jjohnstn@redhat.com>
* libc/include/stdlib.h (_atoll_r, _atol_r): New prototypes.
* libc/stdlib/atol.c (_atol_r): New reentrant function.
* libc/stdlib/atoll.c (_atoll_r): Ditto.
2003-11-27 Artem B. Bityuckiy <mail_lists@mail.ru> 2003-11-27 Artem B. Bityuckiy <mail_lists@mail.ru>
Jeff Johnston <jjohnstn@redhat.com> Jeff Johnston <jjohnstn@redhat.com>

View File

@ -63,6 +63,7 @@ float _EXFUN(atoff,(const char *__nptr));
#endif #endif
int _EXFUN(atoi,(const char *__nptr)); int _EXFUN(atoi,(const char *__nptr));
long _EXFUN(atol,(const char *__nptr)); long _EXFUN(atol,(const char *__nptr));
long _EXFUN(_atol_r,(struct _reent *, const char *__nptr));
_PTR _EXFUN(bsearch,(const _PTR __key, _PTR _EXFUN(bsearch,(const _PTR __key,
const _PTR __base, const _PTR __base,
size_t __nmemb, size_t __nmemb,
@ -164,6 +165,7 @@ unsigned short *
_VOID _EXFUN(srand48,(long)); _VOID _EXFUN(srand48,(long));
_VOID _EXFUN(_srand48_r,(struct _reent *, long)); _VOID _EXFUN(_srand48_r,(struct _reent *, long));
long long _EXFUN(atoll,(const char *__nptr)); long long _EXFUN(atoll,(const char *__nptr));
long long _EXFUN(_atoll_r,(struct _reent *, const char *__nptr));
long long _EXFUN(llabs,(long long)); long long _EXFUN(llabs,(long long));
lldiv_t _EXFUN(lldiv,(long long __numer, long long __denom)); lldiv_t _EXFUN(lldiv,(long long __numer, long long __denom));
long long _EXFUN(strtoll,(const char *__n, char **__end_PTR, int __base)); long long _EXFUN(strtoll,(const char *__n, char **__end_PTR, int __base));

View File

@ -5,8 +5,17 @@
#include <stdlib.h> #include <stdlib.h>
#include <_ansi.h> #include <_ansi.h>
#ifndef _REENT_ONLY
long long
_DEFUN (atol, (s), _CONST char *s) _DEFUN (atol, (s), _CONST char *s)
{ {
return strtol (s, NULL, 10); return strtol (s, NULL, 10);
} }
#endif /* !_REENT_ONLY */
long
_DEFUN (_atol_r, (ptr, s), struct _reent *ptr _AND _CONST char *s)
{
return _strtol_r (ptr, s, NULL, 10);
}

View File

@ -4,21 +4,32 @@ FUNCTION
INDEX INDEX
atoll atoll
INDEX
_atoll_r
ANSI_SYNOPSIS ANSI_SYNOPSIS
#include <stdlib.h> #include <stdlib.h>
long long atoll(const char *<[str]>); long long atoll(const char *<[str]>);
long long _atoll_r(struct _reent *<[ptr]>, const char *<[str]>);
TRAD_SYNOPSIS TRAD_SYNOPSIS
#include <stdlib.h> #include <stdlib.h>
long long atoll(<[str]>) long long atoll(<[str]>)
const char *<[str]>; const char *<[str]>;
long long _atoll_r(<[ptr]>, <[str]>)
struct _reent *<[ptr]>;
const char *<[str]>;
DESCRIPTION DESCRIPTION
The function <<atoll>> converts the initial portion of the string The function <<atoll>> converts the initial portion of the string
pointed to by <<*<[str]>>> to a type <<long long>>. The call to pointed to by <<*<[str]>>> to a type <<long long>>. A call to
atoll(str) should be equivalent to strtoll(str, (char **)NULL, 10) atoll(str) in this implementation is equivalent to
except that <<atoll>> doesn't detect errors. strtoll(str, (char **)NULL, 10) including behavior on error.
The alternate function <<_atoll_r>> is a reentrant version. The
extra argument <[reent]> is a pointer to a reentrancy structure.
RETURNS RETURNS
The converted value. The converted value.
@ -65,9 +76,19 @@ No supporting OS subroutines are required.
#include <stdlib.h> #include <stdlib.h>
#include <stddef.h> #include <stddef.h>
#ifndef _REENT_ONLY
long long long long
_DEFUN(atoll, (str), _DEFUN(atoll, (str),
_CONST char *str) _CONST char *str)
{ {
return strtoll(str, (char **)NULL, 10); return strtoll(str, (char **)NULL, 10);
} }
#endif /* !_REENT_ONLY */
long long
_DEFUN(_atoll_r, (ptr, str),
struct _reent *ptr _AND
_CONST char *str)
{
return _strtoll_r(ptr, str, (char **)NULL, 10);
}