summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJack Jansen <jack.jansen@cwi.nl>2000-08-25 21:57:23 (GMT)
committerJack Jansen <jack.jansen@cwi.nl>2000-08-25 21:57:23 (GMT)
commit14a9171cffd8a2a675e07b90b519c67da35326d6 (patch)
tree4e1f1c0a41901a526938e0ee5bedd3d8c56c6502
parenta1a4b5916b08b24ac0f326949f6d0a0a3cedb963 (diff)
downloadcpython-14a9171cffd8a2a675e07b90b519c67da35326d6.zip
cpython-14a9171cffd8a2a675e07b90b519c67da35326d6.tar.gz
cpython-14a9171cffd8a2a675e07b90b519c67da35326d6.tar.bz2
Cheaper implementation of PyOS_CheckStack: only call StackSpace once and keep a sentinel in a static variable.
-rw-r--r--Mac/Python/macglue.c9
1 files changed, 6 insertions, 3 deletions
diff --git a/Mac/Python/macglue.c b/Mac/Python/macglue.c
index 8b3d6e1..240fc01 100644
--- a/Mac/Python/macglue.c
+++ b/Mac/Python/macglue.c
@@ -410,10 +410,13 @@ PyMac_Error(OSErr err)
int
PyOS_CheckStack()
{
- long left;
+ char here;
+ static char *sentinel = 0;
- left = StackSpace();
- if ( left < MINIMUM_STACK_SIZE )
+ if ( sentinel == 0 ) {
+ sentinel = &here - StackSpace() + MINIMUM_STACK_SIZE;
+ }
+ if ( &here < sentinel )
return -1;
return 0;
}