diff options
author | dkf <dkf@noemail.net> | 2009-01-08 16:41:34 (GMT) |
---|---|---|
committer | dkf <dkf@noemail.net> | 2009-01-08 16:41:34 (GMT) |
commit | bb2e95f0aafc8ebb940170baaf51bc6cd82b0a61 (patch) | |
tree | 267ec42d4b8749e2fc3f2492f172710bd8a8b5d0 /generic/tclDictObj.c | |
parent | 0fa3f0a1d28cc276043d8841fb5668c135fd9965 (diff) | |
download | tcl-bb2e95f0aafc8ebb940170baaf51bc6cd82b0a61.zip tcl-bb2e95f0aafc8ebb940170baaf51bc6cd82b0a61.tar.gz tcl-bb2e95f0aafc8ebb940170baaf51bc6cd82b0a61.tar.bz2 |
Generate errorcodes for more cases.
FossilOrigin-Name: a12728cbb91807a88ca7e1a6e8d4678ca5eee07b
Diffstat (limited to 'generic/tclDictObj.c')
-rw-r--r-- | generic/tclDictObj.c | 14 |
1 files changed, 11 insertions, 3 deletions
diff --git a/generic/tclDictObj.c b/generic/tclDictObj.c index 666cf46..1212dac 100644 --- a/generic/tclDictObj.c +++ b/generic/tclDictObj.c @@ -9,7 +9,7 @@ * See the file "license.terms" for information on usage and redistribution of * this file, and for a DISCLAIMER OF ALL WARRANTIES. * - * RCS: @(#) $Id: tclDictObj.c,v 1.73 2009/01/06 16:03:47 dkf Exp $ + * RCS: @(#) $Id: tclDictObj.c,v 1.74 2009/01/08 16:41:34 dkf Exp $ */ #include "tclInt.h" @@ -592,6 +592,7 @@ SetDictFromAny( if (interp != NULL) { Tcl_SetResult(interp, "missing value to go with key", TCL_STATIC); + Tcl_SetErrorCode(interp, "TCL", "VALUE", "DICTIONARY", NULL); } return TCL_ERROR; } @@ -644,6 +645,9 @@ SetDictFromAny( result = TclFindElement(interp, p, lenRemain, &elemStart, &nextElem, &elemSize, &hasBrace); if (result != TCL_OK) { + if (interp != NULL) { + Tcl_SetErrorCode(interp, "TCL", "VALUE", "DICTIONARY", NULL); + } goto errorExit; } if (elemStart >= limit) { @@ -676,6 +680,9 @@ SetDictFromAny( result = TclFindElement(interp, p, lenRemain, &elemStart, &nextElem, &elemSize, &hasBrace); if (result != TCL_OK) { + if (interp != NULL) { + Tcl_SetErrorCode(interp, "TCL", "VALUE", "DICTIONARY", NULL); + } TclDecrRefCount(keyPtr); goto errorExit; } @@ -690,7 +697,7 @@ SetDictFromAny( s = ckalloc((unsigned) elemSize + 1); if (hasBrace) { - memcpy((void *) s, (void *) elemStart, (size_t) elemSize); + memcpy(s, elemStart, (size_t) elemSize); s[elemSize] = 0; } else { elemSize = TclCopyAndCollapse(elemSize, elemStart, s); @@ -712,7 +719,7 @@ SetDictFromAny( TclDecrRefCount(discardedValue); } Tcl_SetHashValue(hPtr, valuePtr); - Tcl_IncrRefCount(valuePtr); /* since hash now holds ref to it */ + Tcl_IncrRefCount(valuePtr); /* Since hash now holds ref to it. */ } installHash: @@ -733,6 +740,7 @@ SetDictFromAny( missingKey: if (interp != NULL) { Tcl_SetResult(interp, "missing value to go with key", TCL_STATIC); + Tcl_SetErrorCode(interp, "TCL", "VALUE", "DICTIONARY", NULL); } TclDecrRefCount(keyPtr); result = TCL_ERROR; |