Cheaper implementation of PyOS_CheckStack: only call StackSpace once and keep a sentinel in a static variable.

This commit is contained in:
Jack Jansen 2000-08-25 21:57:23 +00:00
parent a1a4b5916b
commit 14a9171cff
1 changed files with 6 additions and 3 deletions

View File

@ -410,10 +410,13 @@ PyMac_Error(OSErr err)
int int
PyOS_CheckStack() PyOS_CheckStack()
{ {
long left; char here;
static char *sentinel = 0;
left = StackSpace(); if ( sentinel == 0 ) {
if ( left < MINIMUM_STACK_SIZE ) sentinel = &here - StackSpace() + MINIMUM_STACK_SIZE;
}
if ( &here < sentinel )
return -1; return -1;
return 0; return 0;
} }