diff options
author | ferrieux <ferrieux@noemail.net> | 2010-03-01 22:20:50 (GMT) |
---|---|---|
committer | ferrieux <ferrieux@noemail.net> | 2010-03-01 22:20:50 (GMT) |
commit | 9e572ee3673392fc6d16576d08554bf5173f2151 (patch) | |
tree | f470a9ae3479fc912a2556dbc24ed9ce302ae427 /generic/tclIndexObj.c | |
parent | b2f7e3d049f2bdcd537ff727df91fc27b428bb34 (diff) | |
download | tcl-9e572ee3673392fc6d16576d08554bf5173f2151.zip tcl-9e572ee3673392fc6d16576d08554bf5173f2151.tar.gz tcl-9e572ee3673392fc6d16576d08554bf5173f2151.tar.bz2 |
fix [AT 86258]: special-casing of empty tables when generating error messages for [::tcl::prefix match].
FossilOrigin-Name: 6f9f9e629d0652c2ed0196b0680786d38d6cc1be
Diffstat (limited to 'generic/tclIndexObj.c')
-rw-r--r-- | generic/tclIndexObj.c | 26 |
1 files changed, 15 insertions, 11 deletions
diff --git a/generic/tclIndexObj.c b/generic/tclIndexObj.c index f631d73..ee1ec43 100644 --- a/generic/tclIndexObj.c +++ b/generic/tclIndexObj.c @@ -12,7 +12,7 @@ * See the file "license.terms" for information on usage and redistribution of * this file, and for a DISCLAIMER OF ALL WARRANTIES. * - * RCS: @(#) $Id: tclIndexObj.c,v 1.55 2010/02/24 10:32:17 dkf Exp $ + * RCS: @(#) $Id: tclIndexObj.c,v 1.56 2010/03/01 22:20:51 ferrieux Exp $ */ #include "tclInt.h" @@ -365,16 +365,20 @@ Tcl_GetIndexFromObjStruct( TclNewObj(resultPtr); Tcl_SetObjResult(interp, resultPtr); Tcl_AppendStringsToObj(resultPtr, (numAbbrev > 1) && - !(flags & TCL_EXACT) ? "ambiguous " : "bad ", msg, " \"", key, - "\": must be ", STRING_AT(tablePtr, offset, 0), NULL); - for (entryPtr = NEXT_ENTRY(tablePtr, offset), count = 0; - *entryPtr != NULL; - entryPtr = NEXT_ENTRY(entryPtr, offset), count++) { - if (*NEXT_ENTRY(entryPtr, offset) == NULL) { - Tcl_AppendStringsToObj(resultPtr, ((count > 0) ? "," : ""), - " or ", *entryPtr, NULL); - } else { - Tcl_AppendStringsToObj(resultPtr, ", ", *entryPtr, NULL); + !(flags & TCL_EXACT) ? "ambiguous " : "bad ", msg, " \"", key, NULL); + if (STRING_AT(tablePtr, offset, 0) == NULL) { + Tcl_AppendStringsToObj(resultPtr, "\": empty table !", NULL); + } else { + Tcl_AppendStringsToObj(resultPtr, "\": must be ", STRING_AT(tablePtr, offset, 0), NULL); + for (entryPtr = NEXT_ENTRY(tablePtr, offset), count = 0; + *entryPtr != NULL; + entryPtr = NEXT_ENTRY(entryPtr, offset), count++) { + if (*NEXT_ENTRY(entryPtr, offset) == NULL) { + Tcl_AppendStringsToObj(resultPtr, ((count > 0) ? "," : ""), + " or ", *entryPtr, NULL); + } else { + Tcl_AppendStringsToObj(resultPtr, ", ", *entryPtr, NULL); + } } } Tcl_SetErrorCode(interp, "TCL", "LOOKUP", "INDEX", msg, key, NULL); |