summaryrefslogtreecommitdiffstats
path: root/generic/tclIndexObj.c
diff options
context:
space:
mode:
authorericm <ericm>2000-08-07 22:42:31 (GMT)
committerericm <ericm>2000-08-07 22:42:31 (GMT)
commit6010721a7deebd7a9b038b2ae93b4d8bd8f7cb24 (patch)
tree61d50d1446176d04a1b82fa826f3b9a3afbaa10e /generic/tclIndexObj.c
parent17cf10d104c7cd7e936cbab403f027b19d3ac265 (diff)
downloadtcl-6010721a7deebd7a9b038b2ae93b4d8bd8f7cb24.zip
tcl-6010721a7deebd7a9b038b2ae93b4d8bd8f7cb24.tar.gz
tcl-6010721a7deebd7a9b038b2ae93b4d8bd8f7cb24.tar.bz2
* tests/indexObj.test: Added tests using the [testwrongnumargs]
command to test Tcl_WrongNumArgs. * generic/tclTest.c (TestWrongNumArgsObjCmd): Added test function for the Tcl_WrongNumArgs function. * generic/tclIndexObj.c (Tcl_WrongNumArgs): Corrected algorithm to not insert a space before the message component when objc == 0 [Bug: 6078].
Diffstat (limited to 'generic/tclIndexObj.c')
-rw-r--r--generic/tclIndexObj.c12
1 files changed, 9 insertions, 3 deletions
diff --git a/generic/tclIndexObj.c b/generic/tclIndexObj.c
index 7e60153..49bbe63 100644
--- a/generic/tclIndexObj.c
+++ b/generic/tclIndexObj.c
@@ -10,7 +10,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.5 2000/06/06 19:34:34 hobbs Exp $
+ * RCS: @(#) $Id: tclIndexObj.c,v 1.6 2000/08/07 22:42:31 ericm Exp $
*/
#include "tclInt.h"
@@ -334,12 +334,18 @@ Tcl_WrongNumArgs(interp, objc, objv, message)
Tcl_AppendStringsToObj(objPtr, Tcl_GetString(objv[i]),
(char *) NULL);
}
- if (i < (objc - 1)) {
+
+ /*
+ * Append a space character (" ") if there is more text to follow
+ * (either another element from objv, or the message string).
+ */
+ if ((i < (objc - 1)) || message) {
Tcl_AppendStringsToObj(objPtr, " ", (char *) NULL);
}
}
+
if (message) {
- Tcl_AppendStringsToObj(objPtr, " ", message, (char *) NULL);
+ Tcl_AppendStringsToObj(objPtr, message, (char *) NULL);
}
Tcl_AppendStringsToObj(objPtr, "\"", (char *) NULL);
}