[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Changes to gnats/libiberty/strtoul.c
From: |
Milan Zamazal |
Subject: |
Changes to gnats/libiberty/strtoul.c |
Date: |
Mon, 10 Dec 2001 18:04:32 -0500 |
Index: gnats/libiberty/strtoul.c
diff -c gnats/libiberty/strtoul.c:1.2 gnats/libiberty/strtoul.c:1.3
*** gnats/libiberty/strtoul.c:1.2 Tue Oct 26 03:10:16 1999
--- gnats/libiberty/strtoul.c Mon Dec 10 18:03:26 2001
***************
*** 10,19 ****
* 2. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
! * 3. All advertising materials mentioning features or use of this software
! * must display the following acknowledgement:
! * This product includes software developed by the University of
! * California, Berkeley and its contributors.
* 4. Neither the name of the University nor the names of its contributors
* may be used to endorse or promote products derived from this software
* without specific prior written permission.
--- 10,16 ----
* 2. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
! * 3. [rescinded 22 July 1999]
* 4. Neither the name of the University nor the names of its contributors
* may be used to endorse or promote products derived from this software
* without specific prior written permission.
***************
*** 31,43 ****
* SUCH DAMAGE.
*/
#include <limits.h>
! #include <ctype.h>
#include <errno.h>
#if 0
#include <stdlib.h>
#endif
#include "ansidecl.h"
#ifndef ULONG_MAX
#define ULONG_MAX ((unsigned long)(~0L)) /* 0xFFFFFFFF */
--- 28,51 ----
* SUCH DAMAGE.
*/
+ #ifdef HAVE_CONFIG_H
+ #include "config.h"
+ #endif
+ #ifdef HAVE_LIMITS_H
#include <limits.h>
! #endif
! #ifdef HAVE_SYS_PARAM_H
! #include <sys/param.h>
! #endif
#include <errno.h>
+ #ifdef NEED_DECLARATION_ERRNO
+ extern int errno;
+ #endif
#if 0
#include <stdlib.h>
#endif
#include "ansidecl.h"
+ #include "safe-ctype.h"
#ifndef ULONG_MAX
#define ULONG_MAX ((unsigned long)(~0L)) /* 0xFFFFFFFF */
***************
*** 66,72 ****
*/
do {
c = *s++;
! } while (isspace(c));
if (c == '-') {
neg = 1;
c = *s++;
--- 74,80 ----
*/
do {
c = *s++;
! } while (ISSPACE(c));
if (c == '-') {
neg = 1;
c = *s++;
***************
*** 83,97 ****
cutoff = (unsigned long)ULONG_MAX / (unsigned long)base;
cutlim = (unsigned long)ULONG_MAX % (unsigned long)base;
for (acc = 0, any = 0;; c = *s++) {
! if (isdigit(c))
c -= '0';
! else if (isalpha(c))
! c -= isupper(c) ? 'A' - 10 : 'a' - 10;
else
break;
if (c >= base)
break;
! if (any < 0 || acc > cutoff || acc == cutoff && c > cutlim)
any = -1;
else {
any = 1;
--- 91,105 ----
cutoff = (unsigned long)ULONG_MAX / (unsigned long)base;
cutlim = (unsigned long)ULONG_MAX % (unsigned long)base;
for (acc = 0, any = 0;; c = *s++) {
! if (ISDIGIT(c))
c -= '0';
! else if (ISALPHA(c))
! c -= ISUPPER(c) ? 'A' - 10 : 'a' - 10;
else
break;
if (c >= base)
break;
! if (any < 0 || acc > cutoff || (acc == cutoff && c > cutlim))
any = -1;
else {
any = 1;
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- Changes to gnats/libiberty/strtoul.c,
Milan Zamazal <=