diff options
author | dkf <donal.k.fellows@manchester.ac.uk> | 2013-08-22 07:09:21 (GMT) |
---|---|---|
committer | dkf <donal.k.fellows@manchester.ac.uk> | 2013-08-22 07:09:21 (GMT) |
commit | 2f5ec3509d4e78728930acdb71d70eec99124817 (patch) | |
tree | 4d0e3e6df74f68526a9dc07d56327e5c4cbab382 /generic/tclParse.c | |
parent | 5703a8e2b37f931de4a54b10dc8dd269848da9bb (diff) | |
parent | 3f61f168eb9d98c28312cdea25b214827c3692f2 (diff) | |
download | tcl-2f5ec3509d4e78728930acdb71d70eec99124817.zip tcl-2f5ec3509d4e78728930acdb71d70eec99124817.tar.gz tcl-2f5ec3509d4e78728930acdb71d70eec99124817.tar.bz2 |
merge trunk
Diffstat (limited to 'generic/tclParse.c')
-rw-r--r-- | generic/tclParse.c | 15 |
1 files changed, 7 insertions, 8 deletions
diff --git a/generic/tclParse.c b/generic/tclParse.c index 08615a7..c5cb1d1 100644 --- a/generic/tclParse.c +++ b/generic/tclParse.c @@ -13,6 +13,7 @@ * this file, and for a DISCLAIMER OF ALL WARRANTIES. */ +#include <assert.h> #include "tclInt.h" #include "tclParse.h" @@ -1567,6 +1568,7 @@ Tcl_ParseVar( code = TclSubstTokens(interp, parsePtr->tokenPtr, parsePtr->numTokens, NULL, 1, NULL, NULL); + Tcl_FreeParse(parsePtr); TclStackFree(interp, parsePtr); if (code != TCL_OK) { return NULL; @@ -1577,16 +1579,13 @@ Tcl_ParseVar( * At this point we should have an object containing the value of a * variable. Just return the string from that object. * - * This should have returned the object for the user to manage, but - * instead we have some weak reference to the string value in the object, - * which is why we make sure the object exists after resetting the result. - * This isn't ideal, but it's the best we can do with the current - * documented interface. -- hobbs + * Since TclSubstTokens above returned TCL_OK, we know that objPtr + * is shared. It is in both the interp result and the value of the + * variable. Returning the string relies on that to be true. */ - if (!Tcl_IsShared(objPtr)) { - Tcl_IncrRefCount(objPtr); - } + assert( Tcl_IsShared(objPtr) ); + Tcl_ResetResult(interp); return TclGetString(objPtr); } |