diff options
author | dkf <donal.k.fellows@manchester.ac.uk> | 2014-06-07 14:18:40 (GMT) |
---|---|---|
committer | dkf <donal.k.fellows@manchester.ac.uk> | 2014-06-07 14:18:40 (GMT) |
commit | 860a7252bb242157af32c222cca494d3d9635bc4 (patch) | |
tree | 92e97e060472f0662cb300189f025d1c30885d4f /generic/tclDictObj.c | |
parent | 0fbfb196c3b93d788a90aecc5b76dfedbbd9f007 (diff) | |
download | tcl-860a7252bb242157af32c222cca494d3d9635bc4.zip tcl-860a7252bb242157af32c222cca494d3d9635bc4.tar.gz tcl-860a7252bb242157af32c222cca494d3d9635bc4.tar.bz2 |
Improved the error messages.
We do not want parsing an invalid dictionary to give errors about lists!
As compensation, we get greater precision in the errorcode.
Diffstat (limited to 'generic/tclDictObj.c')
-rw-r--r-- | generic/tclDictObj.c | 14 |
1 files changed, 5 insertions, 9 deletions
diff --git a/generic/tclDictObj.c b/generic/tclDictObj.c index f3c582c..77f66fb 100644 --- a/generic/tclDictObj.c +++ b/generic/tclDictObj.c @@ -651,9 +651,9 @@ SetDictFromAny( const char *elemStart; int elemSize, literal; - if (TclFindElement(interp, nextElem, (limit - nextElem), + if (TclFindDictElement(interp, nextElem, (limit - nextElem), &elemStart, &nextElem, &elemSize, &literal) != TCL_OK) { - goto errorInFindElement; + goto errorInFindDictElement; } if (elemStart == limit) { break; @@ -672,10 +672,10 @@ SetDictFromAny( keyPtr->bytes); } - if (TclFindElement(interp, nextElem, (limit - nextElem), + if (TclFindDictElement(interp, nextElem, (limit - nextElem), &elemStart, &nextElem, &elemSize, &literal) != TCL_OK) { TclDecrRefCount(keyPtr); - goto errorInFindElement; + goto errorInFindDictElement; } if (literal) { @@ -720,12 +720,8 @@ SetDictFromAny( Tcl_SetObjResult(interp, Tcl_NewStringObj( "missing value to go with key", -1)); Tcl_SetErrorCode(interp, "TCL", "VALUE", "DICTIONARY", NULL); - } else { - errorInFindElement: - if (interp != NULL) { - Tcl_SetErrorCode(interp, "TCL", "VALUE", "DICTIONARY", NULL); - } } + errorInFindDictElement: DeleteChainTable(dict); ckfree(dict); return TCL_ERROR; |