32 lines
1.1 KiB
C
32 lines
1.1 KiB
C
#ifndef __STDLIB_P_H__
|
|
# define __STDLIB_P_H__
|
|
|
|
#include <stdlib.h>
|
|
#include <stdbool.h>
|
|
|
|
/* Parse an integer from a string. This is the base function for strtol,
|
|
strtoul, strtoll, and strtoull.
|
|
|
|
This function does not set errno, and instead returns the error code
|
|
according to conversion rules. Setting errno is troublesome because it's a
|
|
global state that cannot be reverted and thus cannot be tested.
|
|
|
|
If outl is non-NULL, strto_int produces a long or an unsigned long result
|
|
(depending on use_unsigned). Signedness only affects the range of values
|
|
that are considered to be ERANGE, and both results are stored in *outl.
|
|
Similarly, if outll is non-NULL, strto_int produces a long long or unsigned
|
|
long long result. Only one pointer should be non-NULL.
|
|
|
|
On platforms where long is 32-bit, 64-bit operations are performed only if
|
|
outll is non-NULL. This is because multiplications with overflow can be
|
|
expensive. */
|
|
int strto_int(
|
|
char const * restrict __ptr,
|
|
char ** restrict __endptr,
|
|
int __base,
|
|
long *__outl,
|
|
long long *__outll,
|
|
bool __use_unsigned);
|
|
|
|
#endif /*__STDLIB_P_H__*/
|