diff options
Diffstat (limited to 'generic/tclCompile.c')
-rw-r--r-- | generic/tclCompile.c | 26 |
1 files changed, 8 insertions, 18 deletions
diff --git a/generic/tclCompile.c b/generic/tclCompile.c index 10845d3..66d4bea 100644 --- a/generic/tclCompile.c +++ b/generic/tclCompile.c @@ -11,7 +11,7 @@ * See the file "license.terms" for information on usage and redistribution * of this file, and for a DISCLAIMER OF ALL WARRANTIES. * - * RCS: @(#) $Id: tclCompile.c,v 1.50 2003/09/12 23:55:32 dkf Exp $ + * RCS: @(#) $Id: tclCompile.c,v 1.51 2003/10/14 15:44:52 dgp Exp $ */ #include "tclInt.h" @@ -1613,10 +1613,9 @@ LogCompilationInfo(interp, script, command, length) int length; /* Number of bytes in command (-1 means * use all bytes up to first null byte). */ { - char buffer[200]; register CONST char *p; - char *ellipsis = ""; Interp *iPtr = (Interp *) interp; + Tcl_Obj *message; if (iPtr->flags & ERR_ALREADY_LOGGED) { /* @@ -1638,21 +1637,12 @@ LogCompilationInfo(interp, script, command, length) } } - /* - * Create an error message to add to errorInfo, including up to a - * maximum number of characters of the command. - */ - - if (length < 0) { - length = strlen(command); - } - if (length > 150) { - length = 150; - ellipsis = "..."; - } - sprintf(buffer, "\n while compiling\n\"%.*s%s\"", - length, command, ellipsis); - Tcl_AddObjErrorInfo(interp, buffer, -1); + message = Tcl_NewStringObj("\n while compiling\n\"", -1); + Tcl_IncrRefCount(message); + TclAppendLimitedToObj(message, command, length, 153, NULL); + Tcl_AppendToObj(message, "\"", -1); + TclAppendObjToErrorInfo(interp, message); + Tcl_DecrRefCount(message); } /* |