summaryrefslogtreecommitdiffstats
path: root/generic/tclIOUtil.c
diff options
context:
space:
mode:
authordgp <dgp@users.sourceforge.net>2005-09-14 17:13:18 (GMT)
committerdgp <dgp@users.sourceforge.net>2005-09-14 17:13:18 (GMT)
commit9e5a076c152f19abbf9f1b67392bd2072bac77c7 (patch)
tree6faa8807c6893dae4bd8cd9d5668a911697e0dfe /generic/tclIOUtil.c
parentd6a5a988b1a1360a77a043ec10d175c8a6c0fd36 (diff)
downloadtcl-9e5a076c152f19abbf9f1b67392bd2072bac77c7.zip
tcl-9e5a076c152f19abbf9f1b67392bd2072bac77c7.tar.gz
tcl-9e5a076c152f19abbf9f1b67392bd2072bac77c7.tar.bz2
* generic/tclStringObj.c: Bug fixes: ObjPrintfVA needed to
support "*" fields and needed to interpret precision limits on %s conversions as a number of bytes, not Tcl_UniChars, to take from the (char *) argument. * generic/tclBasic.c: Updated several callers to use * generic/tclCmdMZ.c: TclFormatToErrorInfo(). * generic/tclIOUtil.c: * library/init.tcl: Keep [unknown] in sync with errorInfo formatting rules.
Diffstat (limited to 'generic/tclIOUtil.c')
-rw-r--r--generic/tclIOUtil.c20
1 files changed, 7 insertions, 13 deletions
diff --git a/generic/tclIOUtil.c b/generic/tclIOUtil.c
index b540f90..124da3a 100644
--- a/generic/tclIOUtil.c
+++ b/generic/tclIOUtil.c
@@ -17,7 +17,7 @@
* See the file "license.terms" for information on usage and redistribution of
* this file, and for a DISCLAIMER OF ALL WARRANTIES.
*
- * RCS: @(#) $Id: tclIOUtil.c,v 1.122 2005/08/31 15:12:18 vincentdarley Exp $
+ * RCS: @(#) $Id: tclIOUtil.c,v 1.123 2005/09/14 17:13:18 dgp Exp $
*/
#include "tclInt.h"
@@ -1812,19 +1812,13 @@ Tcl_FSEvalFileEx(interp, pathPtr, encodingName)
/*
* Record information telling where the error occurred.
*/
-
- Tcl_Obj *errorLine = Tcl_NewIntObj(interp->errorLine);
- Tcl_Obj *msg = Tcl_NewStringObj("\n (file \"", -1);
CONST char *pathString = Tcl_GetStringFromObj(pathPtr, &length);
- Tcl_IncrRefCount(msg);
- Tcl_IncrRefCount(errorLine);
- TclAppendLimitedToObj(msg, pathString, length, 150, "");
- Tcl_AppendToObj(msg, "\" line ", -1);
- Tcl_AppendObjToObj(msg, errorLine);
- Tcl_DecrRefCount(errorLine);
- Tcl_AppendToObj(msg, ")", -1);
- TclAppendObjToErrorInfo(interp, msg);
- Tcl_DecrRefCount(msg);
+ int limit = 150;
+ int overflow = (length > limit);
+
+ TclFormatToErrorInfo(interp, "\n (file \"%.*s%s\" line %d)",
+ (overflow ? limit : length), pathString,
+ (overflow ? "..." : ""), interp->errorLine);
}
end: