diff options
author | dgp <dgp@users.sourceforge.net> | 2005-09-14 18:35:56 (GMT) |
---|---|---|
committer | dgp <dgp@users.sourceforge.net> | 2005-09-14 18:35:56 (GMT) |
commit | dc74c2b374a963186c53482685a2c91773ade3da (patch) | |
tree | 28c1fdc6337644a54db7b5bca28532e98ecda291 /generic/tclNamesp.c | |
parent | 9e5a076c152f19abbf9f1b67392bd2072bac77c7 (diff) | |
download | tcl-dc74c2b374a963186c53482685a2c91773ade3da.zip tcl-dc74c2b374a963186c53482685a2c91773ade3da.tar.gz tcl-dc74c2b374a963186c53482685a2c91773ade3da.tar.bz2 |
* generic/tclBasic.c: Updated several callers to use
* generic/tclCmdMZ.c: TclFormatToErrorInfo().
* generic/tclIOUtil.c:
* generic/tclNamesp.c:
* generic/tclProc.c:
Diffstat (limited to 'generic/tclNamesp.c')
-rw-r--r-- | generic/tclNamesp.c | 41 |
1 files changed, 17 insertions, 24 deletions
diff --git a/generic/tclNamesp.c b/generic/tclNamesp.c index 5702304..2acedcb 100644 --- a/generic/tclNamesp.c +++ b/generic/tclNamesp.c @@ -21,7 +21,7 @@ * See the file "license.terms" for information on usage and redistribution * of this file, and for a DISCLAIMER OF ALL WARRANTIES. * - * RCS: @(#) $Id: tclNamesp.c,v 1.83 2005/08/26 11:00:31 dkf Exp $ + * RCS: @(#) $Id: tclNamesp.c,v 1.84 2005/09/14 18:35:56 dgp Exp $ */ #include "tclInt.h" @@ -3403,17 +3403,14 @@ NamespaceEvalCmd(dummy, interp, objc, objv) } if (result == TCL_ERROR) { - Tcl_Obj *errorLine = Tcl_NewIntObj(interp->errorLine); - Tcl_Obj *msg = Tcl_NewStringObj("\n (in namespace eval \"", -1); - Tcl_IncrRefCount(errorLine); - Tcl_IncrRefCount(msg); - TclAppendLimitedToObj(msg, namespacePtr->fullName, -1, 200, ""); - Tcl_AppendToObj(msg, "\" script line ", -1); - Tcl_AppendObjToObj(msg, errorLine); - Tcl_DecrRefCount(errorLine); - Tcl_AppendToObj(msg, ")", -1); - TclAppendObjToErrorInfo(interp, msg); - Tcl_DecrRefCount(msg); + int length = strlen(namespacePtr->fullName); + int limit = 200; + int overflow = (length > limit); + + TclFormatToErrorInfo(interp, + "\n (in namespace eval \"%.*s%s\" script line %d)", + (overflow ? limit : length), namespacePtr->fullName, + (overflow ? "..." : ""), interp->errorLine); } /* @@ -3816,18 +3813,14 @@ NamespaceInscopeCmd(dummy, interp, objc, objv) } if (result == TCL_ERROR) { - Tcl_Obj *errorLine = Tcl_NewIntObj(interp->errorLine); - Tcl_Obj *msg = Tcl_NewStringObj("\n (in namespace inscope \"", -1); - - Tcl_IncrRefCount(errorLine); - Tcl_IncrRefCount(msg); - TclAppendLimitedToObj(msg, namespacePtr->fullName, -1, 200, ""); - Tcl_AppendToObj(msg, "\" script line ", -1); - Tcl_AppendObjToObj(msg, errorLine); - Tcl_DecrRefCount(errorLine); - Tcl_AppendToObj(msg, ")", -1); - TclAppendObjToErrorInfo(interp, msg); - Tcl_DecrRefCount(msg); + int length = strlen(namespacePtr->fullName); + int limit = 200; + int overflow = (length > limit); + + TclFormatToErrorInfo(interp, + "\n (in namespace inscope \"%.*s%s\" script line %d)", + (overflow ? limit : length), namespacePtr->fullName, + (overflow ? "..." : ""), interp->errorLine); } /* |