summaryrefslogtreecommitdiffstats
path: root/Python/mystrtoul.c
diff options
context:
space:
mode:
authorGuido van Rossum <guido@python.org>1994-08-01 11:34:53 (GMT)
committerGuido van Rossum <guido@python.org>1994-08-01 11:34:53 (GMT)
commitb6775db241f5fe5e3dc2ca09fc6c9e6164d4b2af (patch)
tree9362939305b2d088b8f19a530c9015d886bc2801 /Python/mystrtoul.c
parent2979b01ff88ac4c5b316d9bf98edbaaaffac8e24 (diff)
downloadcpython-b6775db241f5fe5e3dc2ca09fc6c9e6164d4b2af.zip
cpython-b6775db241f5fe5e3dc2ca09fc6c9e6164d4b2af.tar.gz
cpython-b6775db241f5fe5e3dc2ca09fc6c9e6164d4b2af.tar.bz2
Merge alpha100 branch back to main trunk
Diffstat (limited to 'Python/mystrtoul.c')
-rw-r--r--Python/mystrtoul.c16
1 files changed, 12 insertions, 4 deletions
diff --git a/Python/mystrtoul.c b/Python/mystrtoul.c
index 965421b..6b2a06f 100644
--- a/Python/mystrtoul.c
+++ b/Python/mystrtoul.c
@@ -1,5 +1,5 @@
/***********************************************************
-Copyright 1991, 1992, 1993 by Stichting Mathematisch Centrum,
+Copyright 1991, 1992, 1993, 1994 by Stichting Mathematisch Centrum,
Amsterdam, The Netherlands.
All Rights Reserved
@@ -22,6 +22,12 @@ OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
******************************************************************/
+#ifdef HAVE_CONFIG_H
+#include "config.h"
+#endif
+
+/* strtol and strtoul, renamed to avoid conflicts */
+
/*
** strtoul
** This is a general purpose routine for converting
@@ -40,7 +46,7 @@ OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
#include <errno.h>
unsigned long
-strtoul(str, ptr, base)
+mystrtoul(str, ptr, base)
register char * str;
char ** ptr;
int base;
@@ -108,8 +114,10 @@ int base;
}
temp = result;
result = result * base + c;
+#ifndef MPW
if ((result - c) / base != temp) /* overflow */
ovf = 1;
+#endif
str++;
}
@@ -125,7 +133,7 @@ int base;
}
long
-strtol(str, ptr, base)
+mystrtol(str, ptr, base)
char * str;
char ** ptr;
int base;
@@ -140,7 +148,7 @@ int base;
if (sign == '+' || sign == '-')
str++;
- result = (long) strtoul(str, ptr, base);
+ result = (long) mystrtoul(str, ptr, base);
/* Signal overflow if the result appears negative,
except for the largest negative integer */