diff options
author | Jeff Johnston <jjohnstn@redhat.com> | 2003-11-27 20:15:47 +0000 |
---|---|---|
committer | Jeff Johnston <jjohnstn@redhat.com> | 2003-11-27 20:15:47 +0000 |
commit | 83bf7d2f89d008a8d6c958f2020f78e26c525a4d (patch) | |
tree | 86438a54fdc28d391f79392261823bfbcfe6e0d0 /newlib/libc/stdlib/atoll.c | |
parent | 6bbb700c348150b7f16b185ec63eb0c1fcc92584 (diff) | |
download | newlib-83bf7d2f89d008a8d6c958f2020f78e26c525a4d.zip newlib-83bf7d2f89d008a8d6c958f2020f78e26c525a4d.tar.gz newlib-83bf7d2f89d008a8d6c958f2020f78e26c525a4d.tar.bz2 |
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.
Diffstat (limited to 'newlib/libc/stdlib/atoll.c')
-rw-r--r-- | newlib/libc/stdlib/atoll.c | 27 |
1 files changed, 24 insertions, 3 deletions
diff --git a/newlib/libc/stdlib/atoll.c b/newlib/libc/stdlib/atoll.c index 1dd4ec3..a6abd95 100644 --- a/newlib/libc/stdlib/atoll.c +++ b/newlib/libc/stdlib/atoll.c @@ -4,21 +4,32 @@ FUNCTION INDEX atoll +INDEX + _atoll_r ANSI_SYNOPSIS #include <stdlib.h> long long atoll(const char *<[str]>); + long long _atoll_r(struct _reent *<[ptr]>, const char *<[str]>); TRAD_SYNOPSIS #include <stdlib.h> long long atoll(<[str]>) const char *<[str]>; + long long _atoll_r(<[ptr]>, <[str]>) + struct _reent *<[ptr]>; + const char *<[str]>; + DESCRIPTION The function <<atoll>> converts the initial portion of the string -pointed to by <<*<[str]>>> to a type <<long long>>. The call to -atoll(str) should be equivalent to strtoll(str, (char **)NULL, 10) -except that <<atoll>> doesn't detect errors. +pointed to by <<*<[str]>>> to a type <<long long>>. A call to +atoll(str) in this implementation is equivalent to +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 The converted value. @@ -65,9 +76,19 @@ No supporting OS subroutines are required. #include <stdlib.h> #include <stddef.h> +#ifndef _REENT_ONLY long long _DEFUN(atoll, (str), _CONST char *str) { 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); +} |