From 8623f173db65444f40f7d70462c80360fc5dc8af Mon Sep 17 00:00:00 2001 From: "jan.nijtmans" Date: Tue, 28 Aug 2018 20:30:42 +0000 Subject: Eliminate static function AddObjErrorInfo, which is only used once --- generic/tclBasic.c | 43 ++++--------------------------------------- 1 file changed, 4 insertions(+), 39 deletions(-) diff --git a/generic/tclBasic.c b/generic/tclBasic.c index 87f411d..4b60d2c 100644 --- a/generic/tclBasic.c +++ b/generic/tclBasic.c @@ -91,7 +91,6 @@ static int CheckDoubleResult(Tcl_Interp *interp, double dResult); static void DeleteCoroutine(ClientData clientData); static void DeleteInterpProc(Tcl_Interp *interp); static void DeleteOpCmdClientData(ClientData clientData); -static void AddObjErrorInfo(Tcl_Interp *, const char *, int length); #ifdef USE_DTRACE static Tcl_ObjCmdProc DTraceObjCmd; static Tcl_NRPostProc DTraceCmdReturn; @@ -6225,7 +6224,6 @@ Tcl_ExprString( *---------------------------------------------------------------------- */ -#undef Tcl_AddObjErrorInfo void Tcl_AppendObjToErrorInfo( Tcl_Interp *interp, /* Interpreter to which error information @@ -6233,43 +6231,9 @@ Tcl_AppendObjToErrorInfo( Tcl_Obj *objPtr) /* Message to record. */ { const char *message = TclGetString(objPtr); + register Interp *iPtr = (Interp *) interp; Tcl_IncrRefCount(objPtr); - AddObjErrorInfo(interp, message, objPtr->length); - Tcl_DecrRefCount(objPtr); -} - -/* - *---------------------------------------------------------------------- - * - * Tcl_AddObjErrorInfo -- - * - * Add information to the errorInfo field that describes the current - * error. This routine differs from Tcl_AddErrorInfo by taking a byte - * pointer and length. - * - * Results: - * None. - * - * Side effects: - * "length" bytes from "message" are appended to the errorInfo field. If - * "length" is negative, use bytes up to the first NULL byte. If we are - * just starting to log an error, errorInfo is initialized from the error - * message in the interpreter's result. - * - *---------------------------------------------------------------------- - */ - -void -AddObjErrorInfo( - Tcl_Interp *interp, /* Interpreter to which error information - * pertains. */ - const char *message, /* Points to the first byte of an array of - * bytes of the message. */ - int length) /* The number of bytes in the message. If < 0, - * then append all bytes up to a NULL byte. */ -{ - register Interp *iPtr = (Interp *) interp; /* * If we are just starting to log an error, errorInfo is initialized from @@ -6289,14 +6253,15 @@ AddObjErrorInfo( * Now append "message" to the end of errorInfo. */ - if (length != 0) { + if (objPtr->length != 0) { if (Tcl_IsShared(iPtr->errorInfo)) { Tcl_DecrRefCount(iPtr->errorInfo); iPtr->errorInfo = Tcl_DuplicateObj(iPtr->errorInfo); Tcl_IncrRefCount(iPtr->errorInfo); } - Tcl_AppendToObj(iPtr->errorInfo, message, length); + Tcl_AppendToObj(iPtr->errorInfo, message, objPtr->length); } + Tcl_DecrRefCount(objPtr); } /* -- cgit v0.12