]> git.ipfire.org Git - thirdparty/Python/cpython.git/commitdiff
Cheaper implementation of PyOS_CheckStack: only call StackSpace once and keep a senti...
authorJack Jansen <jack.jansen@cwi.nl>
Fri, 25 Aug 2000 21:57:23 +0000 (21:57 +0000)
committerJack Jansen <jack.jansen@cwi.nl>
Fri, 25 Aug 2000 21:57:23 +0000 (21:57 +0000)
Mac/Python/macglue.c

index 8b3d6e139c6c2655b0d6805a6888776a00cd1cff..240fc0157a961f2d4b858158c9698a845f32bc7a 100644 (file)
@@ -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;
 }