1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
|
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
|
-
+
|
/*
* tclUnixInit.c --
*
* Contains the Unix-specific interpreter initialization functions.
*
* Copyright (c) 1995-1997 Sun Microsystems, Inc.
* Copyright (c) 1999 by Scriptics Corporation.
* All rights reserved.
*
* RCS: @(#) $Id: tclUnixInit.c,v 1.67 2006/09/10 17:04:07 das Exp $
* RCS: @(#) $Id: tclUnixInit.c,v 1.68 2007/02/08 23:11:21 hobbs Exp $
*/
#include "tclInt.h"
#include <stddef.h>
#include <locale.h>
#ifdef HAVE_LANGINFO
# include <langinfo.h>
|
1026
1027
1028
1029
1030
1031
1032
1033
1034
1035
1036
1037
1038
1039
1040
|
1026
1027
1028
1029
1030
1031
1032
1033
1034
1035
1036
1037
1038
1039
1040
|
-
+
|
#else
ThreadSpecificData *tsdPtr = TCL_TSD_INIT(&dataKey);
/* Most variables are actually in a
* thread-specific data block to minimise the
* impact on the stack. */
register ptrdiff_t stackUsed;
register size_t stackUsed;
int localVar; /* Reference to somewhere on the local stack.
* This is declared last so it's as "deep" as
* possible. */
if (tsdPtr == NULL) {
/*
* This should probably be a panic(); if we're out of stack, we might
|
1085
1086
1087
1088
1089
1090
1091
1092
1093
1094
1095
1096
1097
1098
1099
|
1085
1086
1087
1088
1089
1090
1091
1092
1093
1094
1095
1096
1097
1098
1099
|
-
+
|
stackUsed = (char *)tsdPtr->outerVarPtr - (char *)&localVar;
}
/*
* Now we perform the actual check. Are we about to blow our stack frame?
*/
if (stackUsed < (ptrdiff_t) tsdPtr->stackSize) {
if (stackUsed < tsdPtr->stackSize) {
STACK_DEBUG(("stack OK\tin:%p\tout:%p\tuse:%04X\tmax:%04X\n",
&localVar, tsdPtr->outerVarPtr, stackUsed, tsdPtr->stackSize));
return 1;
} else {
STACK_DEBUG(("stack OVERFLOW\tin:%p\tout:%p\tuse:%04X\tmax:%04X\n",
&localVar, tsdPtr->outerVarPtr, stackUsed, tsdPtr->stackSize));
return 0;
|