Deleted Added
full compact
strtoul.c (9845) strtoul.c (17141)
1/*
2 * Copyright (c) 1990, 1993
3 * The Regents of the University of California. All rights reserved.
4 *
5 * Redistribution and use in source and binary forms, with or without
6 * modification, are permitted provided that the following conditions
7 * are met:
8 * 1. Redistributions of source code must retain the above copyright

--- 76 unchanged lines hidden (view full) ---

85 if (isdigit(c))
86 c -= '0';
87 else if (isalpha(c))
88 c -= isupper(c) ? 'A' - 10 : 'a' - 10;
89 else
90 break;
91 if (c >= base)
92 break;
1/*
2 * Copyright (c) 1990, 1993
3 * The Regents of the University of California. All rights reserved.
4 *
5 * Redistribution and use in source and binary forms, with or without
6 * modification, are permitted provided that the following conditions
7 * are met:
8 * 1. Redistributions of source code must retain the above copyright

--- 76 unchanged lines hidden (view full) ---

85 if (isdigit(c))
86 c -= '0';
87 else if (isalpha(c))
88 c -= isupper(c) ? 'A' - 10 : 'a' - 10;
89 else
90 break;
91 if (c >= base)
92 break;
93 if (any < 0 || acc > cutoff || acc == cutoff && c > cutlim)
93 if (any < 0 || acc > cutoff || (acc == cutoff && c > cutlim))
94 any = -1;
95 else {
96 any = 1;
97 acc *= base;
98 acc += c;
99 }
100 }
101 if (any < 0) {
102 acc = ULONG_MAX;
103 errno = ERANGE;
104 } else if (neg)
105 acc = -acc;
106 if (endptr != 0)
107 *endptr = (char *)(any ? s - 1 : nptr);
108 return (acc);
109}
94 any = -1;
95 else {
96 any = 1;
97 acc *= base;
98 acc += c;
99 }
100 }
101 if (any < 0) {
102 acc = ULONG_MAX;
103 errno = ERANGE;
104 } else if (neg)
105 acc = -acc;
106 if (endptr != 0)
107 *endptr = (char *)(any ? s - 1 : nptr);
108 return (acc);
109}