getnameinfo: make size check not fail for bigger sizes
[musl.git] / src / stdlib / atoll.c
blobb69304895a35c9143ec27ac61ec3a2d24c7a5a59
1 #include <stdlib.h>
2 #include <ctype.h>
4 long long atoll(const char *s)
6 long long n=0;
7 int neg=0;
8 while (isspace(*s)) s++;
9 switch (*s) {
10 case '-': neg=1;
11 case '+': s++;
13 /* Compute n as a negative number to avoid overflow on LLONG_MIN */
14 while (isdigit(*s))
15 n = 10*n - (*s++ - '0');
16 return neg ? n : -n;