Lephenixnoir
06f975f75c
The presumed bug where the value computed without the sign overflows even though the negative result can be represented is not actually a problem, because this only happens with signed results and the temporary value is computed as unsigned (thus with extra range).
11 lines
233 B
C
11 lines
233 B
C
#include "stdlib_p.h"
|
|
#include <errno.h>
|
|
|
|
long int strtol(char const * restrict ptr, char ** restrict endptr, int base)
|
|
{
|
|
long n = 0;
|
|
int err = strto_int(ptr, endptr, base, &n, NULL, false);
|
|
if(err != 0) errno = err;
|
|
return n;
|
|
}
|