summaryrefslogtreecommitdiffstats
path: root/generic
diff options
context:
space:
mode:
authordkf <donal.k.fellows@manchester.ac.uk>2012-12-23 08:18:10 (GMT)
committerdkf <donal.k.fellows@manchester.ac.uk>2012-12-23 08:18:10 (GMT)
commite0230df857c0b68a377034f56e3aa424feceb5a1 (patch)
tree904a5c784012083beffa88301ce90c0d9ca69bc6 /generic
parent4f3dd6a05175dd7cda7751de8463eac57598e349 (diff)
parent42c352d6258bc3ec26c19183c29b5a4ac4301a81 (diff)
downloadtcl-e0230df857c0b68a377034f56e3aa424feceb5a1.zip
tcl-e0230df857c0b68a377034f56e3aa424feceb5a1.tar.gz
tcl-e0230df857c0b68a377034f56e3aa424feceb5a1.tar.bz2
merge trunk
Diffstat (limited to 'generic')
-rw-r--r--generic/tclStubLib.c24
-rw-r--r--generic/tclUtil.c18
2 files changed, 16 insertions, 26 deletions
diff --git a/generic/tclStubLib.c b/generic/tclStubLib.c
index a9d0f02..859cbf9 100644
--- a/generic/tclStubLib.c
+++ b/generic/tclStubLib.c
@@ -23,22 +23,8 @@ const TclPlatStubs *tclPlatStubsPtr = NULL;
const TclIntStubs *tclIntStubsPtr = NULL;
const TclIntPlatStubs *tclIntPlatStubsPtr = NULL;
-static const TclStubs *
-HasStubSupport(
- Tcl_Interp *interp)
-{
- Interp *iPtr = (Interp *) interp;
-
- if (iPtr->stubTable && (iPtr->stubTable->magic == TCL_STUB_MAGIC)) {
- return iPtr->stubTable;
- }
- iPtr->result = (char *) "interpreter uses an incompatible stubs mechanism";
- iPtr->freeProc = TCL_STATIC;
- return NULL;
-}
-
/*
- * Use our own isdigit to avoid linking to libc on windows
+ * Use our own isDigit to avoid linking to libc on windows
*/
static int isDigit(const int c)
@@ -70,9 +56,10 @@ Tcl_InitStubs(
const char *version,
int exact)
{
+ Interp *iPtr = (Interp *) interp;
const char *actualVersion = NULL;
ClientData pkgData = NULL;
- const TclStubs *stubsPtr;
+ const TclStubs *stubsPtr = iPtr->stubTable;
/*
* We can't optimize this check by caching tclStubsPtr because that
@@ -80,8 +67,9 @@ Tcl_InitStubs(
* times. [Bug 615304]
*/
- stubsPtr = HasStubSupport(interp);
- if (!stubsPtr) {
+ if (!stubsPtr || (stubsPtr->magic != TCL_STUB_MAGIC)) {
+ iPtr->result = "interpreter uses an incompatible stubs mechanism";
+ iPtr->freeProc = TCL_STATIC;
return NULL;
}
diff --git a/generic/tclUtil.c b/generic/tclUtil.c
index 13e54ec..ddf067b 100644
--- a/generic/tclUtil.c
+++ b/generic/tclUtil.c
@@ -2927,14 +2927,16 @@ TclDStringToObj(
{
Tcl_Obj *result;
- if (dsPtr->length == 0) {
- TclNewObj(result);
- } else if (dsPtr->string == dsPtr->staticSpace) {
- /*
- * Static buffer, so must copy.
- */
-
- TclNewStringObj(result, dsPtr->string, dsPtr->length);
+ if (dsPtr->string == dsPtr->staticSpace) {
+ if (dsPtr->length == 0) {
+ TclNewObj(result);
+ } else {
+ /*
+ * Static buffer, so must copy.
+ */
+
+ TclNewStringObj(result, dsPtr->string, dsPtr->length);
+ }
} else {
/*
* Dynamic buffer, so transfer ownership and reset.