summaryrefslogtreecommitdiffstats
path: root/generic/tclDictObj.c
diff options
context:
space:
mode:
authordkf <dkf@noemail.net>2014-06-04 08:15:26 (GMT)
committerdkf <dkf@noemail.net>2014-06-04 08:15:26 (GMT)
commit5152d68c261d64a54491e55a99dbb9d816b7dfff (patch)
tree2dae9f188dcd75e17fd3675e74af2dbeb8e265a8 /generic/tclDictObj.c
parentaafe0072abbb691b542f633c85c10af6e5344674 (diff)
downloadtcl-5152d68c261d64a54491e55a99dbb9d816b7dfff.zip
tcl-5152d68c261d64a54491e55a99dbb9d816b7dfff.tar.gz
tcl-5152d68c261d64a54491e55a99dbb9d816b7dfff.tar.bz2
more tests, cleaning up the code a bit
FossilOrigin-Name: 1fd96b571fe5677a0ffb82aa43586f8f6d1b2674
Diffstat (limited to 'generic/tclDictObj.c')
-rw-r--r--generic/tclDictObj.c29
1 files changed, 13 insertions, 16 deletions
diff --git a/generic/tclDictObj.c b/generic/tclDictObj.c
index 71d5f5d..f3c582c 100644
--- a/generic/tclDictObj.c
+++ b/generic/tclDictObj.c
@@ -600,7 +600,7 @@ SetDictFromAny(
Tcl_Obj *objPtr)
{
Tcl_HashEntry *hPtr;
- int isNew, result;
+ int isNew;
Dict *dict = ckalloc(sizeof(Dict));
InitChainTable(dict);
@@ -651,10 +651,9 @@ SetDictFromAny(
const char *elemStart;
int elemSize, literal;
- result = TclFindElement(interp, nextElem, (limit - nextElem),
- &elemStart, &nextElem, &elemSize, &literal);
- if (result != TCL_OK) {
- goto errorExit;
+ if (TclFindElement(interp, nextElem, (limit - nextElem),
+ &elemStart, &nextElem, &elemSize, &literal) != TCL_OK) {
+ goto errorInFindElement;
}
if (elemStart == limit) {
break;
@@ -673,11 +672,10 @@ SetDictFromAny(
keyPtr->bytes);
}
- result = TclFindElement(interp, nextElem, (limit - nextElem),
- &elemStart, &nextElem, &elemSize, &literal);
- if (result != TCL_OK) {
+ if (TclFindElement(interp, nextElem, (limit - nextElem),
+ &elemStart, &nextElem, &elemSize, &literal) != TCL_OK) {
TclDecrRefCount(keyPtr);
- goto errorExit;
+ goto errorInFindElement;
}
if (literal) {
@@ -722,16 +720,15 @@ SetDictFromAny(
Tcl_SetObjResult(interp, Tcl_NewStringObj(
"missing value to go with key", -1));
Tcl_SetErrorCode(interp, "TCL", "VALUE", "DICTIONARY", NULL);
- }
- result = TCL_ERROR;
-
- errorExit:
- if (interp != NULL) {
- Tcl_SetErrorCode(interp, "TCL", "VALUE", "DICTIONARY", NULL);
+ } else {
+ errorInFindElement:
+ if (interp != NULL) {
+ Tcl_SetErrorCode(interp, "TCL", "VALUE", "DICTIONARY", NULL);
+ }
}
DeleteChainTable(dict);
ckfree(dict);
- return result;
+ return TCL_ERROR;
}
/*