diff options
author | dkf <donal.k.fellows@manchester.ac.uk> | 2010-03-05 14:34:03 (GMT) |
---|---|---|
committer | dkf <donal.k.fellows@manchester.ac.uk> | 2010-03-05 14:34:03 (GMT) |
commit | b501910778714de837dc4367698256e996737e9b (patch) | |
tree | f2dc6d4861ea238a538f41c4306249dad1ac3ea5 /generic/tclEnsemble.c | |
parent | f7a64b3a111891d5f7f79ce94bbb37abedd30176 (diff) | |
download | tcl-b501910778714de837dc4367698256e996737e9b.zip tcl-b501910778714de837dc4367698256e996737e9b.tar.gz tcl-b501910778714de837dc4367698256e996737e9b.tar.bz2 |
Code Audit results:
* use do { ... } while (0) in macros
* avoid shadowing one local variable with another
* use clearer 'foo.bar++;' instead of '++foo.bar;' where result not
required (i.e., semantically equivalent)
* follow Engineering Manual rules on spacing and declarations
Diffstat (limited to 'generic/tclEnsemble.c')
-rw-r--r-- | generic/tclEnsemble.c | 28 |
1 files changed, 14 insertions, 14 deletions
diff --git a/generic/tclEnsemble.c b/generic/tclEnsemble.c index bc92251..c4750c5 100644 --- a/generic/tclEnsemble.c +++ b/generic/tclEnsemble.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: tclEnsemble.c,v 1.4 2010/02/24 10:32:17 dkf Exp $ + * RCS: @(#) $Id: tclEnsemble.c,v 1.5 2010/03/05 14:34:04 dkf Exp $ */ #include "tclInt.h" @@ -204,14 +204,14 @@ TclNamespaceEnsembleCmd( paramObj = (len > 0 ? objv[1] : NULL); continue; case CRT_MAP: { - Tcl_Obj *patchedDict = NULL, *subcmdObj; + Tcl_Obj *patchedDict = NULL, *subcmdWordsObj; /* * Verify that the map is sensible. */ if (Tcl_DictObjFirst(interp, objv[1], &search, - &subcmdObj, &listObj, &done) != TCL_OK) { + &subcmdWordsObj, &listObj, &done) != TCL_OK) { if (allocatedMapFlag) { Tcl_DecrRefCount(mapObj); } @@ -262,9 +262,10 @@ TclNamespaceEnsembleCmd( if (patchedDict == NULL) { patchedDict = Tcl_DuplicateObj(objv[1]); } - Tcl_DictObjPut(NULL, patchedDict, subcmdObj, newList); + Tcl_DictObjPut(NULL, patchedDict, subcmdWordsObj, + newList); } - Tcl_DictObjNext(&search, &subcmdObj, &listObj, &done); + Tcl_DictObjNext(&search, &subcmdWordsObj,&listObj, &done); } while (!done); if (allocatedMapFlag) { @@ -491,7 +492,7 @@ TclNamespaceEnsembleCmd( paramObj = (len > 0 ? objv[1] : NULL); continue; case CONF_MAP: { - Tcl_Obj *patchedDict = NULL, *subcmdObj, **listv; + Tcl_Obj *patchedDict = NULL, *subcmdWordsObj, **listv; const char *cmd; /* @@ -499,7 +500,7 @@ TclNamespaceEnsembleCmd( */ if (Tcl_DictObjFirst(interp, objv[1], &search, - &subcmdObj, &listObj, &done) != TCL_OK) { + &subcmdWordsObj, &listObj, &done) != TCL_OK) { goto freeMapAndError; } if (done) { @@ -539,10 +540,11 @@ TclNamespaceEnsembleCmd( if (patchedDict == NULL) { patchedDict = Tcl_DuplicateObj(objv[1]); } - Tcl_DictObjPut(NULL, patchedDict, subcmdObj, + Tcl_DictObjPut(NULL, patchedDict, subcmdWordsObj, newList); } - Tcl_DictObjNext(&search, &subcmdObj, &listObj, &done); + Tcl_DictObjNext(&search, &subcmdWordsObj, &listObj, + &done); } while (!done); if (allocatedMapFlag) { Tcl_DecrRefCount(mapObj); @@ -865,14 +867,14 @@ Tcl_SetEnsembleMappingDict( for (Tcl_DictObjFirst(NULL, mapDict, &search, NULL, &valuePtr, &done); !done; Tcl_DictObjNext(&search, NULL, &valuePtr, &done)) { - Tcl_Obj *cmdPtr; + Tcl_Obj *cmdObjPtr; const char *bytes; - if (Tcl_ListObjIndex(interp, valuePtr, 0, &cmdPtr) != TCL_OK) { + if (Tcl_ListObjIndex(interp, valuePtr, 0, &cmdObjPtr) != TCL_OK) { Tcl_DictObjDone(&search); return TCL_ERROR; } - bytes = TclGetString(cmdPtr); + bytes = TclGetString(cmdObjPtr); if (bytes[0] != ':' || bytes[1] != ':') { Tcl_AppendResult(interp, "ensemble target is not a fully-qualified command", @@ -2311,8 +2313,6 @@ BuildEnsembleConfig( * Remove pre-existing table. */ - Tcl_HashSearch search; - ckfree((char *) ensemblePtr->subcommandArrayPtr); hPtr = Tcl_FirstHashEntry(hash, &search); while (hPtr != NULL) { |