summaryrefslogtreecommitdiffstats
path: root/generic/tclProc.c
diff options
context:
space:
mode:
authorMiguel Sofer <miguel.sofer@gmail.com>2004-05-02 21:07:16 (GMT)
committerMiguel Sofer <miguel.sofer@gmail.com>2004-05-02 21:07:16 (GMT)
commit0ecdf938ca2b533273751a770d7c794e89faa9d3 (patch)
treeb87265d8e87e83bf87ec8d2a99b6908684e90f81 /generic/tclProc.c
parent3c6bff5072deff3c93b25e7093a21e84b788df3f (diff)
downloadtcl-0ecdf938ca2b533273751a770d7c794e89faa9d3.zip
tcl-0ecdf938ca2b533273751a770d7c794e89faa9d3.tar.gz
tcl-0ecdf938ca2b533273751a770d7c794e89faa9d3.tar.bz2
* generic/tclProc.c (TclObjInvokeProc):
* tests/proc.test (proc-3.6): fix for bad quoting of multi-word proc names in error messages [Bug 942757]
Diffstat (limited to 'generic/tclProc.c')
-rw-r--r--generic/tclProc.c26
1 files changed, 22 insertions, 4 deletions
diff --git a/generic/tclProc.c b/generic/tclProc.c
index 1ec50f1..40c8ceb 100644
--- a/generic/tclProc.c
+++ b/generic/tclProc.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: tclProc.c,v 1.44.2.1 2003/07/18 23:35:39 dgp Exp $
+ * RCS: @(#) $Id: tclProc.c,v 1.44.2.2 2004/05/02 21:07:16 msofer Exp $
*/
#include "tclInt.h"
@@ -910,7 +910,6 @@ TclObjInterpProc(clientData, interp, objc, objv)
register CompiledLocal *localPtr;
char *procName;
int nameLen, localCt, numArgs, argCt, i, result;
- Tcl_Obj *objResult = Tcl_GetObjResult(interp);
/*
* This procedure generates an array "compiledLocals" that holds the
@@ -1037,13 +1036,32 @@ TclObjInterpProc(clientData, interp, objc, objv)
localPtr = localPtr->nextPtr;
}
if (argCt > 0) {
+ Tcl_Obj *objResult;
+ int len, flags;
+
incorrectArgs:
/*
* Build up equivalent to Tcl_WrongNumArgs message for proc
*/
+
Tcl_ResetResult(interp);
- Tcl_AppendStringsToObj(objResult,
- "wrong # args: should be \"", procName, (char *) NULL);
+ objResult = Tcl_GetObjResult(interp);
+ Tcl_AppendToObj(objResult, "wrong # args: should be \"", -1);
+
+ /*
+ * Quote the proc name if it contains spaces (Bug 942757).
+ */
+
+ len = Tcl_ScanCountedElement(procName, nameLen, &flags);
+ if (len != nameLen) {
+ char *procName1 = ckalloc((unsigned) len);
+ len = Tcl_ConvertCountedElement(procName, nameLen, procName1, flags);
+ Tcl_AppendToObj(objResult, procName1, len);
+ ckfree(procName1);
+ } else {
+ Tcl_AppendToObj(objResult, procName, len);
+ }
+
localPtr = procPtr->firstLocalPtr;
for (i = 1; i <= numArgs; i++) {
if (localPtr->defValuePtr != NULL) {