From: Jack Jansen Date: Fri, 25 Aug 2000 21:57:23 +0000 (+0000) Subject: Cheaper implementation of PyOS_CheckStack: only call StackSpace once and keep a senti... X-Git-Tag: v2.0b1~234 X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=14a9171cffd8a2a675e07b90b519c67da35326d6;p=thirdparty%2FPython%2Fcpython.git Cheaper implementation of PyOS_CheckStack: only call StackSpace once and keep a sentinel in a static variable. --- diff --git a/Mac/Python/macglue.c b/Mac/Python/macglue.c index 8b3d6e139c6c..240fc0157a96 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; }