summaryrefslogtreecommitdiffstats
path: root/generic/tclVar.c
diff options
context:
space:
mode:
authordgp <dgp@users.sourceforge.net>2006-02-09 17:34:41 (GMT)
committerdgp <dgp@users.sourceforge.net>2006-02-09 17:34:41 (GMT)
commit3e2f142b59552edeaa2a6bb5e4a5d31e076ae8d7 (patch)
tree19ebc4b4f4d8e5362c861dd8242031f5c8e16600 /generic/tclVar.c
parentaf5c89aba29208e6298cd59900eb13feaac963c8 (diff)
downloadtcl-3e2f142b59552edeaa2a6bb5e4a5d31e076ae8d7.zip
tcl-3e2f142b59552edeaa2a6bb5e4a5d31e076ae8d7.tar.gz
tcl-3e2f142b59552edeaa2a6bb5e4a5d31e076ae8d7.tar.bz2
TIP#215 IMPLEMENTATION
* doc/incr.n: Revised [incr] to auto-initialize when varName * generic/tclExecute.c: argument is unset. [Patch 1413115]. * generic/tclVar.c: * tests/compile.test: * tests/incr-old.test: * tests/incr.test: * tests/set.test:
Diffstat (limited to 'generic/tclVar.c')
-rw-r--r--generic/tclVar.c10
1 files changed, 5 insertions, 5 deletions
diff --git a/generic/tclVar.c b/generic/tclVar.c
index 0977bfc..50b02b3 100644
--- a/generic/tclVar.c
+++ b/generic/tclVar.c
@@ -15,7 +15,7 @@
* See the file "license.terms" for information on usage and redistribution of
* this file, and for a DISCLAIMER OF ALL WARRANTIES.
*
- * RCS: @(#) $Id: tclVar.c,v 1.119 2006/02/02 10:55:05 dkf Exp $
+ * RCS: @(#) $Id: tclVar.c,v 1.120 2006/02/09 17:34:42 dgp Exp $
*/
#include "tclInt.h"
@@ -1780,7 +1780,7 @@ TclIncrObjVar2(
part2 = ((part2Ptr == NULL)? NULL : TclGetString(part2Ptr));
varPtr = TclObjLookupVar(interp, part1Ptr, part2, flags, "read",
- 0, 1, &arrayPtr);
+ 1, 1, &arrayPtr);
if (varPtr == NULL) {
Tcl_AddObjErrorInfo(interp,
"\n (reading value of variable to increment)", -1);
@@ -1839,11 +1839,11 @@ TclPtrIncrObjVar(
register Tcl_Obj *varValuePtr, *newValuePtr = NULL;
int duplicated, code;
+ varPtr->refCount++;
varValuePtr = TclPtrGetVar(interp, varPtr, arrayPtr, part1, part2, flags);
+ varPtr->refCount--;
if (varValuePtr == NULL) {
- Tcl_AddObjErrorInfo(interp,
- "\n (reading value of variable to increment)", -1);
- return NULL;
+ varValuePtr = Tcl_NewIntObj(0);
}
if (Tcl_IsShared(varValuePtr)) {
duplicated = 1;