summaryrefslogtreecommitdiffstats
path: root/generic
diff options
context:
space:
mode:
authorjan.nijtmans <nijtmans@users.sourceforge.net>2016-09-05 14:52:01 (GMT)
committerjan.nijtmans <nijtmans@users.sourceforge.net>2016-09-05 14:52:01 (GMT)
commit2501ad1ea2dd8592c15e7f3bda1f9c298fa446a6 (patch)
tree8b3fcee2d834673ca87d7d3ccf003f43591ccfaf /generic
parente9e3981faf0495befa4c2914d59af0bd994ac23c (diff)
downloadtcl-2501ad1ea2dd8592c15e7f3bda1f9c298fa446a6.zip
tcl-2501ad1ea2dd8592c15e7f3bda1f9c298fa446a6.tar.gz
tcl-2501ad1ea2dd8592c15e7f3bda1f9c298fa446a6.tar.bz2
some more clean-up
Diffstat (limited to 'generic')
-rw-r--r--generic/tclCompile.c10
-rw-r--r--generic/tclEnsemble.c10
-rw-r--r--generic/tclLiteral.c4
-rw-r--r--generic/tclObj.c12
4 files changed, 16 insertions, 20 deletions
diff --git a/generic/tclCompile.c b/generic/tclCompile.c
index ee36bff..f6b3c52 100644
--- a/generic/tclCompile.c
+++ b/generic/tclCompile.c
@@ -1783,17 +1783,15 @@ CompileCmdLiteral(
int numBytes;
const char *bytes;
Command *cmdPtr;
- int cmdLitIdx, extraLiteralFlags = 0;
+ int cmdLitIdx, extraLiteralFlags = LITERAL_CMD_NAME;
cmdPtr = (Command *) Tcl_GetCommandFromObj(interp, cmdObj);
- if (cmdPtr != NULL) {
- if ((cmdPtr->flags & CMD_VIA_RESOLVER)) {
- extraLiteralFlags = LITERAL_UNSHARED;
- }
+ if ((cmdPtr != NULL) && (cmdPtr->flags & CMD_VIA_RESOLVER)) {
+ extraLiteralFlags |= LITERAL_UNSHARED;
}
bytes = Tcl_GetStringFromObj(cmdObj, &numBytes);
- cmdLitIdx = TclRegisterLiteral(envPtr, (char *)bytes, numBytes, extraLiteralFlags|LITERAL_CMD_NAME);
+ cmdLitIdx = TclRegisterLiteral(envPtr, (char *)bytes, numBytes, extraLiteralFlags);
if (cmdPtr) {
TclSetCmdNameObj(interp, TclFetchLiteral(envPtr, cmdLitIdx), cmdPtr);
diff --git a/generic/tclEnsemble.c b/generic/tclEnsemble.c
index 67ee65e..6fedf29 100644
--- a/generic/tclEnsemble.c
+++ b/generic/tclEnsemble.c
@@ -3306,7 +3306,7 @@ CompileToInvokedCommand(
Tcl_Token *tokPtr;
Tcl_Obj *objPtr, **words;
char *bytes;
- int length, i, numWords, cmdLit, extraLiteralFlags = 0;
+ int length, i, numWords, cmdLit, extraLiteralFlags = LITERAL_CMD_NAME;
DefineLineInformation;
/*
@@ -3349,12 +3349,10 @@ CompileToInvokedCommand(
objPtr = Tcl_NewObj();
Tcl_GetCommandFullName(interp, (Tcl_Command) cmdPtr, objPtr);
bytes = Tcl_GetStringFromObj(objPtr, &length);
- if (cmdPtr != NULL) {
- if ((cmdPtr->flags & CMD_VIA_RESOLVER)) {
- extraLiteralFlags = LITERAL_UNSHARED;
- }
+ if ((cmdPtr != NULL) && (cmdPtr->flags & CMD_VIA_RESOLVER)) {
+ extraLiteralFlags |= LITERAL_UNSHARED;
}
- cmdLit = TclRegisterLiteral(envPtr, (char *)bytes, length, extraLiteralFlags|LITERAL_CMD_NAME);
+ cmdLit = TclRegisterLiteral(envPtr, (char *)bytes, length, extraLiteralFlags);
TclSetCmdNameObj(interp, TclFetchLiteral(envPtr, cmdLit), cmdPtr);
TclEmitPush(cmdLit, envPtr);
TclDecrRefCount(objPtr);
diff --git a/generic/tclLiteral.c b/generic/tclLiteral.c
index 484b86b..c329ed7 100644
--- a/generic/tclLiteral.c
+++ b/generic/tclLiteral.c
@@ -249,7 +249,6 @@ TclCreateLiteral(
if (globalPtrPtr != NULL) {
*globalPtrPtr = NULL;
}
- /*fprintf(stderr, "UNSHARED LITERAL <%s>\n", bytes);*/
return objPtr;
}
@@ -1167,6 +1166,9 @@ TclVerifyLocalLiteralTable(
if (LookupLiteralEntry((Tcl_Interp *) envPtr->iPtr,
localPtr->objPtr) == NULL) {
bytes = Tcl_GetStringFromObj(localPtr->objPtr, &length);
+ Tcl_Panic("%s: local literal \"%.*s\" is not global",
+ "TclVerifyLocalLiteralTable",
+ (length>60? 60 : length), bytes);
}
if (localPtr->objPtr->bytes == NULL) {
Tcl_Panic("%s: literal has NULL string rep",
diff --git a/generic/tclObj.c b/generic/tclObj.c
index 661ab48..283c8d2 100644
--- a/generic/tclObj.c
+++ b/generic/tclObj.c
@@ -4219,10 +4219,10 @@ TclSetCmdNameObj(
const char *name;
if (objPtr->typePtr == &tclCmdNameType) {
- resPtr = objPtr->internalRep.twoPtrValue.ptr1;
- if (resPtr->cmdPtr == cmdPtr) {
- return;
- }
+ resPtr = objPtr->internalRep.twoPtrValue.ptr1;
+ if (resPtr->cmdPtr == cmdPtr) {
+ return;
+ }
}
cmdPtr->refCount++;
@@ -4400,9 +4400,7 @@ SetCmdNameFromAny(
cmdPtr->refCount++;
resPtr = objPtr->internalRep.twoPtrValue.ptr1;
if ((objPtr->typePtr == &tclCmdNameType)
- && resPtr != NULL
- && (resPtr->refCount == 1)
- ) {
+ && resPtr && (resPtr->refCount == 1)) {
/*
* Reuse the old ResolvedCmdName struct instead of freeing it
*/