diff options
author | ferrieux <ferrieux@users.sourceforge.net> | 2010-03-01 22:20:50 (GMT) |
---|---|---|
committer | ferrieux <ferrieux@users.sourceforge.net> | 2010-03-01 22:20:50 (GMT) |
commit | 0e6bbcf25f9e4b6964290efecf6ca3e0e416426d (patch) | |
tree | f470a9ae3479fc912a2556dbc24ed9ce302ae427 /generic | |
parent | 40fac87a4b5eb36ddf12e7a72de80cedad5a6158 (diff) | |
download | tcl-0e6bbcf25f9e4b6964290efecf6ca3e0e416426d.zip tcl-0e6bbcf25f9e4b6964290efecf6ca3e0e416426d.tar.gz tcl-0e6bbcf25f9e4b6964290efecf6ca3e0e416426d.tar.bz2 |
fix [AT 86258]: special-casing of empty tables when generating error messages for [::tcl::prefix match].
Diffstat (limited to 'generic')
-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); |