summaryrefslogtreecommitdiffstats
path: root/generic
diff options
context:
space:
mode:
authorjan.nijtmans <nijtmans@users.sourceforge.net>2017-03-17 10:57:24 (GMT)
committerjan.nijtmans <nijtmans@users.sourceforge.net>2017-03-17 10:57:24 (GMT)
commit5dbf2681d7206b079a706e9db96e4cf3f43edb25 (patch)
tree30692de3b7cd3e9f047d1c37c3b09c97b14b73db /generic
parent709c26db6735431a77f3509d28a5c6c6309709bd (diff)
downloadtcl-5dbf2681d7206b079a706e9db96e4cf3f43edb25.zip
tcl-5dbf2681d7206b079a706e9db96e4cf3f43edb25.tar.gz
tcl-5dbf2681d7206b079a706e9db96e4cf3f43edb25.tar.bz2
If Tcl is compiled with -DTCL_NO_DEPRECATED, make sure that iPtr->(resultSpace|appendResult|appendAvl|appendUsed) are not used any more.
Diffstat (limited to 'generic')
-rw-r--r--generic/tclBasic.c10
-rw-r--r--generic/tclInt.h10
-rw-r--r--generic/tclResult.c2
-rw-r--r--generic/tclStubInit.c19
4 files changed, 40 insertions, 1 deletions
diff --git a/generic/tclBasic.c b/generic/tclBasic.c
index 32caac5..685e64c 100644
--- a/generic/tclBasic.c
+++ b/generic/tclBasic.c
@@ -510,7 +510,11 @@ Tcl_CreateInterp(void)
iPtr = ckalloc(sizeof(Interp));
interp = (Tcl_Interp *) iPtr;
+#ifdef TCL_NO_DEPRECATED
+ iPtr->result = &tclEmptyString;
+#else
iPtr->result = iPtr->resultSpace;
+#endif
iPtr->freeProc = NULL;
iPtr->errorLine = 0;
iPtr->objResultPtr = Tcl_NewObj();
@@ -570,9 +574,11 @@ Tcl_CreateInterp(void)
iPtr->rootFramePtr = NULL; /* Initialise as soon as :: is available */
iPtr->lookupNsPtr = NULL;
+#ifndef TCL_NO_DEPRECATED
iPtr->appendResult = NULL;
iPtr->appendAvl = 0;
iPtr->appendUsed = 0;
+#endif
Tcl_InitHashTable(&iPtr->packageTable, TCL_STRING_KEYS);
iPtr->packageUnknown = NULL;
@@ -602,7 +608,9 @@ Tcl_CreateInterp(void)
iPtr->emptyObjPtr = Tcl_NewObj();
/* Another empty object. */
Tcl_IncrRefCount(iPtr->emptyObjPtr);
+#ifndef TCL_NO_DEPRECATED
iPtr->resultSpace[0] = 0;
+#endif
iPtr->threadId = Tcl_GetCurrentThread();
/* TIP #378 */
@@ -1535,10 +1543,12 @@ DeleteInterpProc(
if (iPtr->returnOpts) {
Tcl_DecrRefCount(iPtr->returnOpts);
}
+#ifndef TCL_NO_DEPRECATED
if (iPtr->appendResult != NULL) {
ckfree(iPtr->appendResult);
iPtr->appendResult = NULL;
}
+#endif
TclFreePackageInfo(iPtr);
while (iPtr->tracePtr != NULL) {
Tcl_DeleteTrace((Tcl_Interp *) iPtr, (Tcl_Trace) iPtr->tracePtr);
diff --git a/generic/tclInt.h b/generic/tclInt.h
index 562e895..3845598 100644
--- a/generic/tclInt.h
+++ b/generic/tclInt.h
@@ -1862,6 +1862,7 @@ typedef struct Interp {
* See Tcl_AppendResult code for details.
*/
+#ifndef TCL_NO_DEPRECATED
char *appendResult; /* Storage space for results generated by
* Tcl_AppendResult. Ckalloc-ed. NULL means
* not yet allocated. */
@@ -1869,6 +1870,11 @@ typedef struct Interp {
* partialResult. */
int appendUsed; /* Number of non-null bytes currently stored
* at partialResult. */
+#else
+ char *appendResultDontUse;
+ int appendAvlDontUse;
+ int appendUsedDontUse;
+#endif
/*
* Information about packages. Used only in tclPkg.c.
@@ -1930,8 +1936,12 @@ typedef struct Interp {
* string. Returned by Tcl_ObjSetVar2 when
* variable traces change a variable in a
* gross way. */
+#ifndef TCL_NO_DEPRECATED
char resultSpace[TCL_RESULT_SIZE+1];
/* Static space holding small results. */
+#else
+ char resultSpaceDontUse[TCL_RESULT_SIZE+1];
+#endif
Tcl_Obj *objResultPtr; /* If the last command returned an object
* result, this points to it. Should not be
* accessed directly; see comment above. */
diff --git a/generic/tclResult.c b/generic/tclResult.c
index ddf764b..57a6de5 100644
--- a/generic/tclResult.c
+++ b/generic/tclResult.c
@@ -232,6 +232,7 @@ Tcl_DiscardInterpState(
*----------------------------------------------------------------------
*/
+#ifndef TCL_NO_DEPRECATED
#undef Tcl_SaveResult
void
Tcl_SaveResult(
@@ -409,7 +410,6 @@ Tcl_DiscardResult(
*----------------------------------------------------------------------
*/
-#ifndef TCL_NO_DEPRECATED
void
Tcl_SetResult(
Tcl_Interp *interp, /* Interpreter with which to associate the
diff --git a/generic/tclStubInit.c b/generic/tclStubInit.c
index 816650e..121cf59 100644
--- a/generic/tclStubInit.c
+++ b/generic/tclStubInit.c
@@ -306,6 +306,25 @@ static int formatInt(char *buffer, int n){
# define Tcl_SetResult 0
# undef Tcl_DbNewBooleanObj
# define Tcl_DbNewBooleanObj 0
+# undef Tcl_EvalObj
+# define Tcl_EvalObj 0
+# undef Tcl_GlobalEvalObj
+# define Tcl_GlobalEvalObj 0
+# define Tcl_NewBooleanObj 0
+# undef Tcl_SetBooleanObj
+# define Tcl_SetBooleanObj 0
+# undef Tcl_PkgPresent
+# define Tcl_PkgPresent 0
+# undef Tcl_PkgProvide
+# define Tcl_PkgProvide 0
+# undef Tcl_PkgRequire
+# define Tcl_PkgRequire 0
+# undef Tcl_DiscardResult
+# define Tcl_DiscardResult 0
+# undef Tcl_RestoreResult
+# define Tcl_RestoreResult 0
+# undef Tcl_SaveResult
+# define Tcl_SaveResult 0
#else /* TCL_NO_DEPRECATED */
# define Tcl_SeekOld seekOld
# define Tcl_TellOld tellOld