From 5fecb2e14300561bac581946809bf4414edb16a3 Mon Sep 17 00:00:00 2001 From: dkf Date: Thu, 10 Aug 2006 12:15:28 +0000 Subject: Various minor object file size efficiency fixes. [Bug 1530474] --- ChangeLog | 11 +++ generic/tclBasic.c | 100 +++++++++++----------- generic/tclBinary.c | 8 +- generic/tclClock.c | 213 ++++++++++++++++++++++++----------------------- generic/tclCmdAH.c | 6 +- generic/tclCompCmds.c | 4 +- generic/tclCompExpr.c | 8 +- generic/tclCompile.c | 16 ++-- generic/tclDictObj.c | 16 ++-- generic/tclExecute.c | 10 +-- generic/tclHash.c | 14 ++-- generic/tclListObj.c | 16 ++-- generic/tclLiteral.c | 4 +- generic/tclObj.c | 20 ++--- generic/tclPreserve.c | 4 +- generic/tclStrToD.c | 4 +- generic/tclStringObj.c | 16 ++-- generic/tclThreadAlloc.c | 8 +- generic/tclUtil.c | 4 +- generic/tclVar.c | 16 ++-- macosx/tclMacOSXNotify.c | 40 ++++----- unix/tclUnixNotfy.c | 16 ++-- win/tclWinThrd.c | 10 +-- 23 files changed, 286 insertions(+), 278 deletions(-) diff --git a/ChangeLog b/ChangeLog index c92116a..b4d754f 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,14 @@ +2006-08-10 Donal K. Fellows + + Misc patches to make code more efficient. [Bug 1530474] (afredd) + * generic/*.c, macosx/tclMacOSXNotify.c, unix/tclUnixNotfy.c, + * win/tclWinThrd.c: Tidy up invokations of Tcl_Panic() to promote + string constant sharing and consistent style. + * generic/tclBasic.c (Tcl_CreateInterp): More efficient handling of + * generic/tclClock.c (TclClockInit): registration of commands not + in global namespace. + * generic/tclVar.c (Tcl_UnsetObjCmd): Remove unreachable clause. + 2006-08-09 Don Porter * generic/tclEncoding.c: Replace buffer copy in for loop diff --git a/generic/tclBasic.c b/generic/tclBasic.c index caffa5f..0afd68f 100644 --- a/generic/tclBasic.c +++ b/generic/tclBasic.c @@ -13,7 +13,7 @@ * See the file "license.terms" for information on usage and redistribution of * this file, and for a DISCLAIMER OF ALL WARRANTIES. * - * RCS: @(#) $Id: tclBasic.c,v 1.194 2006/05/04 12:55:49 dgp Exp $ + * RCS: @(#) $Id: tclBasic.c,v 1.195 2006/08/10 12:15:29 dkf Exp $ */ #include "tclInt.h" @@ -200,39 +200,40 @@ static CmdInfo builtInCmds[] = { */ typedef struct { - CONST char* name; /* Name of the function */ - Tcl_ObjCmdProc* objCmdProc; /* Function that evaluates the function */ + CONST char *name; /* Name of the function. The full name is + * "::tcl::mathfunc::". */ + Tcl_ObjCmdProc *objCmdProc; /* Function that evaluates the function */ ClientData clientData; /* Client data for the function */ } BuiltinFuncDef; static BuiltinFuncDef BuiltinFuncTable[] = { - { "::tcl::mathfunc::abs", ExprAbsFunc, NULL }, - { "::tcl::mathfunc::acos", ExprUnaryFunc, (ClientData) acos }, - { "::tcl::mathfunc::asin", ExprUnaryFunc, (ClientData) asin }, - { "::tcl::mathfunc::atan", ExprUnaryFunc, (ClientData) atan }, - { "::tcl::mathfunc::atan2", ExprBinaryFunc, (ClientData) atan2 }, - { "::tcl::mathfunc::bool", ExprBoolFunc, NULL }, - { "::tcl::mathfunc::ceil", ExprCeilFunc, NULL }, - { "::tcl::mathfunc::cos", ExprUnaryFunc, (ClientData) cos }, - { "::tcl::mathfunc::cosh", ExprUnaryFunc, (ClientData) cosh }, - { "::tcl::mathfunc::double",ExprDoubleFunc, NULL }, - { "::tcl::mathfunc::entier",ExprEntierFunc, NULL }, - { "::tcl::mathfunc::exp", ExprUnaryFunc, (ClientData) exp }, - { "::tcl::mathfunc::floor", ExprFloorFunc, NULL }, - { "::tcl::mathfunc::fmod", ExprBinaryFunc, (ClientData) fmod }, - { "::tcl::mathfunc::hypot", ExprBinaryFunc, (ClientData) hypot }, - { "::tcl::mathfunc::int", ExprIntFunc, NULL }, - { "::tcl::mathfunc::log", ExprUnaryFunc, (ClientData) log }, - { "::tcl::mathfunc::log10", ExprUnaryFunc, (ClientData) log10 }, - { "::tcl::mathfunc::pow", ExprBinaryFunc, (ClientData) pow }, - { "::tcl::mathfunc::rand", ExprRandFunc, NULL }, - { "::tcl::mathfunc::round", ExprRoundFunc, NULL }, - { "::tcl::mathfunc::sin", ExprUnaryFunc, (ClientData) sin }, - { "::tcl::mathfunc::sinh", ExprUnaryFunc, (ClientData) sinh }, - { "::tcl::mathfunc::sqrt", ExprSqrtFunc, NULL }, - { "::tcl::mathfunc::srand", ExprSrandFunc, NULL }, - { "::tcl::mathfunc::tan", ExprUnaryFunc, (ClientData) tan }, - { "::tcl::mathfunc::tanh", ExprUnaryFunc, (ClientData) tanh }, - { "::tcl::mathfunc::wide", ExprWideFunc, NULL }, + { "abs", ExprAbsFunc, NULL }, + { "acos", ExprUnaryFunc, (ClientData) acos }, + { "asin", ExprUnaryFunc, (ClientData) asin }, + { "atan", ExprUnaryFunc, (ClientData) atan }, + { "atan2", ExprBinaryFunc, (ClientData) atan2 }, + { "bool", ExprBoolFunc, NULL }, + { "ceil", ExprCeilFunc, NULL }, + { "cos", ExprUnaryFunc, (ClientData) cos }, + { "cosh", ExprUnaryFunc, (ClientData) cosh }, + { "double", ExprDoubleFunc, NULL }, + { "entier", ExprEntierFunc, NULL }, + { "exp", ExprUnaryFunc, (ClientData) exp }, + { "floor", ExprFloorFunc, NULL }, + { "fmod", ExprBinaryFunc, (ClientData) fmod }, + { "hypot", ExprBinaryFunc, (ClientData) hypot }, + { "int", ExprIntFunc, NULL }, + { "log", ExprUnaryFunc, (ClientData) log }, + { "log10", ExprUnaryFunc, (ClientData) log10 }, + { "pow", ExprBinaryFunc, (ClientData) pow }, + { "rand", ExprRandFunc, NULL }, + { "round", ExprRoundFunc, NULL }, + { "sin", ExprUnaryFunc, (ClientData) sin }, + { "sinh", ExprUnaryFunc, (ClientData) sinh }, + { "sqrt", ExprSqrtFunc, NULL }, + { "srand", ExprSrandFunc, NULL }, + { "tan", ExprUnaryFunc, (ClientData) tan }, + { "tanh", ExprUnaryFunc, (ClientData) tanh }, + { "wide", ExprWideFunc, NULL }, { NULL, NULL, NULL } }; @@ -262,8 +263,7 @@ Tcl_CreateInterp(void) Command *cmdPtr; BuiltinFuncDef *builtinFuncPtr; const CmdInfo *cmdInfoPtr; - Tcl_Namespace* mathfuncNSPtr; - int i; + Tcl_Namespace *mathfuncNSPtr; union { char c[sizeof(short)]; short s; @@ -271,6 +271,7 @@ Tcl_CreateInterp(void) #ifdef TCL_COMPILE_STATS ByteCodeStats *statsPtr; #endif /* TCL_COMPILE_STATS */ + char mathFuncName[32]; TclInitSubsystems(); @@ -383,10 +384,8 @@ Tcl_CreateInterp(void) statsPtr->currentSrcBytes = 0.0; statsPtr->currentByteCodeBytes = 0.0; (void) memset(statsPtr->srcCount, 0, sizeof(statsPtr->srcCount)); - (void) memset(statsPtr->byteCodeCount, 0, - sizeof(statsPtr->byteCodeCount)); - (void) memset(statsPtr->lifetimeCount, 0, - sizeof(statsPtr->lifetimeCount)); + (void) memset(statsPtr->byteCodeCount, 0, sizeof(statsPtr->byteCodeCount)); + (void) memset(statsPtr->lifetimeCount, 0, sizeof(statsPtr->lifetimeCount)); statsPtr->currentInstBytes = 0.0; statsPtr->currentLitBytes = 0.0; @@ -437,7 +436,7 @@ Tcl_CreateInterp(void) if ((cmdInfoPtr->objProc == NULL) && (cmdInfoPtr->compileProc == NULL)) { - Tcl_Panic("Tcl_CreateInterp: builtin command with NULL object command proc and a NULL compile proc\n"); + Tcl_Panic("builtin command with NULL object command proc and a NULL compile proc"); } hPtr = Tcl_CreateHashEntry(&iPtr->globalNsPtr->cmdTable, @@ -484,34 +483,29 @@ Tcl_CreateInterp(void) * implemented as commands in the ::tcl::mathfunc namespace. */ - /* * Register the default [interp bgerror] handler. */ - Tcl_CreateObjCommand(interp, "::tcl::Bgerror", - TclDefaultBgErrorHandlerObjCmd, (ClientData) NULL, NULL); + Tcl_CreateObjCommand(interp, "::tcl::Bgerror", + TclDefaultBgErrorHandlerObjCmd, NULL, NULL); /* * Register the builtin math functions. */ - mathfuncNSPtr = Tcl_CreateNamespace(interp, "::tcl::mathfunc", - (ClientData) NULL, NULL); + mathfuncNSPtr = Tcl_CreateNamespace(interp, "::tcl::mathfunc", NULL, NULL); if (mathfuncNSPtr == NULL) { Tcl_Panic("Can't create math function namespace"); } - i = 0; - for (;;) { - CONST char* tail; - builtinFuncPtr = &(BuiltinFuncTable[i++]); - if (builtinFuncPtr->name == NULL) { - break; - } - Tcl_CreateObjCommand(interp, builtinFuncPtr->name, + strcpy(mathFuncName, "::tcl::mathfunc::"); +#define MATH_FUNC_PREFIX_LEN 17 /* == strlen("::tcl::mathfunc::") */ + for (builtinFuncPtr = BuiltinFuncTable; builtinFuncPtr->name != NULL; + builtinFuncPtr++) { + strcpy(mathFuncName+MATH_FUNC_PREFIX_LEN, builtinFuncPtr->name); + Tcl_CreateObjCommand(interp, mathFuncName, builtinFuncPtr->objCmdProc, builtinFuncPtr->clientData, NULL); - tail = builtinFuncPtr->name + strlen("::tcl::mathfunc::"); - Tcl_Export(interp, mathfuncNSPtr, tail, 0); + Tcl_Export(interp, mathfuncNSPtr, builtinFuncPtr->name, 0); } /* diff --git a/generic/tclBinary.c b/generic/tclBinary.c index d3b370c..1d7a48d 100644 --- a/generic/tclBinary.c +++ b/generic/tclBinary.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: tclBinary.c,v 1.28 2006/04/26 13:42:43 dgp Exp $ + * RCS: @(#) $Id: tclBinary.c,v 1.29 2006/08/10 12:15:30 dkf Exp $ */ #include "tclInt.h" @@ -262,7 +262,7 @@ Tcl_SetByteArrayObj( ByteArray *byteArrayPtr; if (Tcl_IsShared(objPtr)) { - Tcl_Panic("Tcl_SetByteArrayObj called with shared object"); + Tcl_Panic("%s called with shared object", "Tcl_SetByteArrayObj"); } TclFreeIntRep(objPtr); Tcl_InvalidateStringRep(objPtr); @@ -341,7 +341,7 @@ Tcl_SetByteArrayLength( ByteArray *byteArrayPtr, *newByteArrayPtr; if (Tcl_IsShared(objPtr)) { - Tcl_Panic("Tcl_SetObjLength called with shared object"); + Tcl_Panic("%s called with shared object", "Tcl_SetByteArrayLength"); } if (objPtr->typePtr != &tclByteArrayType) { SetByteArrayFromAny(NULL, objPtr); @@ -1498,7 +1498,7 @@ NeedReversing( #endif } - Tcl_Panic("unexpected fall-through"); + Tcl_Panic("unexpected fallthrough"); return 0; } diff --git a/generic/tclClock.c b/generic/tclClock.c index 3bce263..a300611 100644 --- a/generic/tclClock.c +++ b/generic/tclClock.c @@ -12,7 +12,7 @@ * See the file "license.terms" for information on usage and redistribution of * this file, and for a DISCLAIMER OF ALL WARRANTIES. * - * RCS: @(#) $Id: tclClock.c,v 1.54 2006/08/02 20:01:39 das Exp $ + * RCS: @(#) $Id: tclClock.c,v 1.55 2006/08/10 12:15:30 dkf Exp $ */ #include "tclInt.h" @@ -111,7 +111,7 @@ typedef struct TclDateFields { int iso8601Week; /* ISO8601 week number */ int dayOfWeek; /* Day of the week */ } TclDateFields; -static CONST char* eras[] = { "CE", "BCE", NULL }; +static const char* eras[] = { "CE", "BCE", NULL }; /* * Thread specific data block holding a 'struct tm' for the 'gmtime' and @@ -134,17 +134,17 @@ TCL_DECLARE_MUTEX(clockMutex) static int ConvertUTCToLocal(Tcl_Interp*, TclDateFields*, Tcl_Obj*, int); static int ConvertUTCToLocalUsingTable(Tcl_Interp*, - TclDateFields*, int, Tcl_Obj *CONST[]); + TclDateFields*, int, Tcl_Obj *const[]); static int ConvertUTCToLocalUsingC(Tcl_Interp*, TclDateFields*, int); static int ConvertLocalToUTC(Tcl_Interp*, TclDateFields*, Tcl_Obj*, int); static int ConvertLocalToUTCUsingTable(Tcl_Interp*, - TclDateFields*, int, Tcl_Obj *CONST[]); + TclDateFields*, int, Tcl_Obj *const[]); static int ConvertLocalToUTCUsingC(Tcl_Interp*, TclDateFields*, int); static Tcl_Obj* LookupLastTransition(Tcl_Interp*, Tcl_WideInt, - int, Tcl_Obj *CONST *); + int, Tcl_Obj *const *); static void GetYearWeekDay(TclDateFields*, int); static void GetGregorianEraYearDay(TclDateFields*, int); static void GetMonthDay(TclDateFields*); @@ -154,35 +154,63 @@ static int IsGregorianLeapYear(TclDateFields*); static int WeekdayOnOrBefore(int, int); static int ClockClicksObjCmd( ClientData clientData, Tcl_Interp *interp, - int objc, Tcl_Obj *CONST objv[]); + int objc, Tcl_Obj *const objv[]); static int ClockConvertlocaltoutcObjCmd( ClientData clientData, Tcl_Interp *interp, - int objc, Tcl_Obj *CONST objv[]); + int objc, Tcl_Obj *const objv[]); static int ClockGetdatefieldsObjCmd( ClientData clientData, Tcl_Interp *interp, - int objc, Tcl_Obj *CONST objv[]); + int objc, Tcl_Obj *const objv[]); static int ClockGetjuliandayfromerayearmonthdayObjCmd( ClientData clientData, Tcl_Interp *interp, - int objc, Tcl_Obj *CONST objv[]); + int objc, Tcl_Obj *const objv[]); static int ClockGetjuliandayfromerayearweekdayObjCmd( ClientData clientData, Tcl_Interp *interp, - int objc, Tcl_Obj *CONST objv[]); + int objc, Tcl_Obj *const objv[]); static int ClockGetenvObjCmd( ClientData clientData, Tcl_Interp *interp, - int objc, Tcl_Obj *CONST objv[]); + int objc, Tcl_Obj *const objv[]); static int ClockMicrosecondsObjCmd( ClientData clientData, Tcl_Interp *interp, - int objc, Tcl_Obj *CONST objv[]); + int objc, Tcl_Obj *const objv[]); static int ClockMillisecondsObjCmd( ClientData clientData, Tcl_Interp *interp, - int objc, Tcl_Obj *CONST objv[]); + int objc, Tcl_Obj *const objv[]); static int ClockSecondsObjCmd( ClientData clientData, Tcl_Interp *interp, - int objc, Tcl_Obj *CONST objv[]); -static struct tm * ThreadSafeLocalTime(CONST time_t *); + int objc, Tcl_Obj *const objv[]); +static struct tm * ThreadSafeLocalTime(const time_t *); static void TzsetIfNecessary(void); static void ClockDeleteCmdProc(ClientData); +/* + * Structure containing description of "native" clock commands to create. + */ + +struct ClockCommand { + const char *name; /* The tail of the command name. The full name + * is "::tcl::clock::". When NULL marks + * the end of the table. */ + Tcl_ObjCmdProc *objCmdProc; /* Function that implements the command. This + * will always have the ClockClientData sent + * to it, but may well ignore this data. */ +}; + +static const struct ClockCommand clockCommands[] = { + { "clicks", ClockClicksObjCmd }, + { "getenv", ClockGetenvObjCmd }, + { "microseconds", ClockMicrosecondsObjCmd }, + { "milliseconds", ClockMillisecondsObjCmd }, + { "seconds", ClockSecondsObjCmd }, + { "Oldscan", TclClockOldscanObjCmd }, + { "ConvertLocalToUTC", ClockConvertlocaltoutcObjCmd }, + { "GetDateFields", ClockGetdatefieldsObjCmd }, + { "GetJulianDayFromEraYearMonthDay", + ClockGetjuliandayfromerayearmonthdayObjCmd }, + { "GetJulianDayFromEraYearWeekDay", + ClockGetjuliandayfromerayearweekdayObjCmd }, + { NULL, NULL } +}; /* *---------------------------------------------------------------------- @@ -204,22 +232,21 @@ static void ClockDeleteCmdProc(ClientData); void TclClockInit( - Tcl_Interp* interp /* Tcl interpreter */ -) { + Tcl_Interp *interp) /* Tcl interpreter */ +{ + struct ClockCommand *clockCmdPtr; + char cmdName[50]; /* Buffer large enough to hold the string + *::tcl::clock::GetJulianDayFromEraYearMonthDay + * plus a terminating NULL. */ + ClockClientData *data; int i; /* - * Create the client data. + * Create the client data, which is a refcounted literal pool. */ - ClockClientData *data = - (ClockClientData*) ckalloc(sizeof(ClockClientData)); + data = (ClockClientData *) ckalloc(sizeof(ClockClientData)); data->refCount = 0; - - /* - * Create the literal pool. - */ - data->literals = (Tcl_Obj**) ckalloc(LIT__END * sizeof(Tcl_Obj*)); for (i = 0; i < LIT__END; ++i) { data->literals[i] = Tcl_NewStringObj(literals[i], -1); @@ -230,36 +257,14 @@ TclClockInit( * Install the commands. */ - Tcl_CreateObjCommand(interp, "::tcl::clock::clicks", - ClockClicksObjCmd, (ClientData) NULL, NULL); - Tcl_CreateObjCommand(interp, "::tcl::clock::getenv", - ClockGetenvObjCmd, (ClientData) NULL, NULL); - Tcl_CreateObjCommand(interp, "::tcl::clock::microseconds", - ClockMicrosecondsObjCmd, (ClientData) NULL, NULL); - Tcl_CreateObjCommand(interp, "::tcl::clock::milliseconds", - ClockMillisecondsObjCmd, (ClientData) NULL, NULL); - Tcl_CreateObjCommand(interp, "::tcl::clock::seconds", - ClockSecondsObjCmd, (ClientData) NULL, NULL); - Tcl_CreateObjCommand(interp, "::tcl::clock::Oldscan", - TclClockOldscanObjCmd, (ClientData) NULL, NULL); - Tcl_CreateObjCommand(interp, "::tcl::clock::ConvertLocalToUTC", - ClockConvertlocaltoutcObjCmd, (ClientData) data, - ClockDeleteCmdProc); - ++data->refCount; - Tcl_CreateObjCommand(interp, "::tcl::clock::GetDateFields", - ClockGetdatefieldsObjCmd,(ClientData) data, - ClockDeleteCmdProc); - ++data->refCount; - Tcl_CreateObjCommand(interp, - "::tcl::clock::GetJulianDayFromEraYearMonthDay", - ClockGetjuliandayfromerayearmonthdayObjCmd,(ClientData) data, - ClockDeleteCmdProc); - ++data->refCount; - Tcl_CreateObjCommand(interp, - "::tcl::clock::GetJulianDayFromEraYearWeekDay", - ClockGetjuliandayfromerayearweekdayObjCmd,(ClientData) data, - ClockDeleteCmdProc); - ++data->refCount; + strcpy(cmdName, "::tcl::clock::"); +#define TCL_CLOCK_PREFIX_LEN 14 /* == strlen("::tcl::clock::") */ + for (clockCmdPtr=clockCommands ; clockCmdPtr->name!=NULL ; clockCmdPtr++) { + strcpy(cmdName + TCL_CLOCK_PREFIX_LEN, clockCmdPtr->name); + data->refCount++; + Tcl_CreateObjCmd(interp, cmdName, clockCmdPtr->objCmdProc, data, + ClockDeleteCmdProc); + } } /* @@ -294,10 +299,10 @@ ClockConvertlocaltoutcObjCmd( ClientData clientData, /* Client data */ Tcl_Interp* interp, /* Tcl interpreter */ int objc, /* Parameter count */ - Tcl_Obj *CONST * objv /* Parameter vector */ -) { + Tcl_Obj *const *objv) /* Parameter vector */ +{ ClockClientData* data = (ClockClientData*) clientData; - Tcl_Obj* CONST * literals = data->literals; + Tcl_Obj* const * literals = data->literals; Tcl_Obj* secondsObj; Tcl_Obj* dict; int changeover; @@ -379,12 +384,12 @@ ClockGetdatefieldsObjCmd( ClientData clientData, /* Opaque pointer to literal pool, etc. */ Tcl_Interp* interp, /* Tcl interpreter */ int objc, /* Parameter count */ - Tcl_Obj *CONST *objv /* Parameter vector */ -) { + Tcl_Obj *const *objv) /* Parameter vector */ +{ TclDateFields fields; Tcl_Obj* dict; ClockClientData* data = (ClockClientData*) clientData; - Tcl_Obj* CONST * literals = data->literals; + Tcl_Obj* const * literals = data->literals; int changeover; /* @@ -483,12 +488,12 @@ ClockGetjuliandayfromerayearmonthdayObjCmd ( ClientData clientData, /* Opaque pointer to literal pool, etc. */ Tcl_Interp* interp, /* Tcl interpreter */ int objc, /* Parameter count */ - Tcl_Obj *CONST *objv /* Parameter vector */ -) { + Tcl_Obj *const *objv) /* Parameter vector */ +{ TclDateFields fields; Tcl_Obj* dict; ClockClientData* data = (ClockClientData*) clientData; - Tcl_Obj* CONST * literals = data->literals; + Tcl_Obj* const * literals = data->literals; Tcl_Obj* fieldPtr; int changeover; int copied = 0; @@ -574,12 +579,12 @@ ClockGetjuliandayfromerayearweekdayObjCmd ( ClientData clientData, /* Opaque pointer to literal pool, etc. */ Tcl_Interp* interp, /* Tcl interpreter */ int objc, /* Parameter count */ - Tcl_Obj *CONST *objv /* Parameter vector */ -) { + Tcl_Obj *const *objv) /* Parameter vector */ +{ TclDateFields fields; Tcl_Obj* dict; ClockClientData* data = (ClockClientData*) clientData; - Tcl_Obj* CONST * literals = data->literals; + Tcl_Obj* const * literals = data->literals; Tcl_Obj* fieldPtr; int changeover; int copied = 0; @@ -664,8 +669,8 @@ ConvertLocalToUTC( Tcl_Interp* interp, /* Tcl interpreter */ TclDateFields* fields, /* Fields of the time */ Tcl_Obj* tzdata, /* Time zone data */ - int changeover /* Julian Day of the Gregorian transition */ -) { + int changeover) /* Julian Day of the Gregorian transition */ +{ int rowc; /* Number of rows in tzdata */ Tcl_Obj** rowv; /* Pointers to the rows */ @@ -712,8 +717,8 @@ ConvertLocalToUTCUsingTable( Tcl_Interp* interp, /* Tcl interpreter */ TclDateFields* fields, /* Time to convert, with 'seconds' filled in */ int rowc, /* Number of points at which time changes */ - Tcl_Obj *CONST rowv[] /* Points at which time changes */ -) { + Tcl_Obj *const rowv[]) /* Points at which time changes */ +{ Tcl_Obj* row; int cellc; Tcl_Obj** cellv; @@ -787,8 +792,8 @@ static int ConvertLocalToUTCUsingC( Tcl_Interp* interp, /* Tcl interpreter */ TclDateFields* fields, /* Time to convert, with 'seconds' filled in */ - int changeover /* Julian Day of the Gregorian transition */ -) { + int changeover) /* Julian Day of the Gregorian transition */ +{ struct tm timeVal; int localErrno; int secondOfDay; @@ -869,8 +874,8 @@ ConvertUTCToLocal( Tcl_Interp* interp, /* Tcl interpreter */ TclDateFields* fields, /* Fields of the time */ Tcl_Obj* tzdata, /* Time zone data */ - int changeover /* Julian Day of the Gregorian transition */ -) { + int changeover) /* Julian Day of the Gregorian transition */ +{ int rowc; /* Number of rows in tzdata */ Tcl_Obj** rowv; /* Pointers to the rows */ @@ -918,8 +923,8 @@ ConvertUTCToLocalUsingTable( TclDateFields* fields, /* Fields of the date */ int rowc, /* Number of rows in the conversion table * (>= 1) */ - Tcl_Obj *CONST rowv[] /* Rows of the conversion table */ -) { + Tcl_Obj *const rowv[]) /* Rows of the conversion table */ +{ Tcl_Obj* row; /* Row containing the current information */ int cellc; /* Count of cells in the row (must be 4) */ Tcl_Obj** cellv; /* Pointers to the cells */ @@ -968,8 +973,8 @@ static int ConvertUTCToLocalUsingC( Tcl_Interp* interp, /* Tcl interpreter */ TclDateFields* fields, /* Time to convert, with 'seconds' filled in */ - int changeover /* Julian Day of the Gregorian transition */ -) { + int changeover) /* Julian Day of the Gregorian transition */ +{ time_t tock; struct tm* timeVal; /* Time after conversion */ int diff; /* Time zone diff local-Greenwich */ @@ -1057,7 +1062,7 @@ LookupLastTransition( Tcl_Interp* interp, /* Interpreter for error messages */ Tcl_WideInt tick, /* Time from the epoch */ int rowc, /* Number of rows of tzdata */ - Tcl_Obj *CONST * rowv) /* Rows in tzdata */ + Tcl_Obj *const *rowv) /* Rows in tzdata */ { int l; int u; @@ -1125,9 +1130,9 @@ LookupLastTransition( static void GetYearWeekDay( TclDateFields* fields, /* Date to convert, must have 'julianDay' */ - int changeover /* Julian Day Number of the Gregorian + int changeover) /* Julian Day Number of the Gregorian * transition */ -) { +{ TclDateFields temp; int dayOfFiscalYear; @@ -1192,8 +1197,8 @@ GetYearWeekDay( static void GetGregorianEraYearDay( TclDateFields* fields, /* Date fields containing 'julianDay' */ - int changeover /* Gregorian transition date */ -) { + int changeover) /* Gregorian transition date */ +{ int jday = fields->julianDay; int day; int year; @@ -1309,8 +1314,8 @@ GetGregorianEraYearDay( static void GetMonthDay( - TclDateFields* fields /* Date to convert */ -) { + TclDateFields* fields) /* Date to convert */ +{ int day = fields->dayOfYear; int month; const int* h = hath[IsGregorianLeapYear(fields)]; @@ -1342,9 +1347,9 @@ GetMonthDay( static void GetJulianDayFromEraYearWeekDay( TclDateFields* fields, /* Date to convert */ - int changeover /* Julian Day Number of the Gregorian + int changeover) /* Julian Day Number of the Gregorian * transition */ -) { +{ int firstMonday; /* Julian day number of week 1, day 1 in the * given year */ @@ -1393,8 +1398,8 @@ GetJulianDayFromEraYearWeekDay( static void GetJulianDayFromEraYearMonthDay( TclDateFields* fields, /* Date to convert */ - int changeover /* Gregorian transition date as a Julian Day */ -) { + int changeover) /* Gregorian transition date as a Julian Day */ +{ int year; int ym1; int month; int mm1; int q; int r; @@ -1490,8 +1495,8 @@ GetJulianDayFromEraYearMonthDay( static int IsGregorianLeapYear( - TclDateFields* fields /* Date to test */ -) { + TclDateFields* fields) /* Date to test */ +{ int year; if (fields->era == BCE) { @@ -1529,8 +1534,8 @@ IsGregorianLeapYear( static int WeekdayOnOrBefore( int dayOfWeek, /* Day of week; Sunday == 0 or 7 */ - int julianDay /* Reference date */ -) { + int julianDay) /* Reference date */ +{ int k = (dayOfWeek + 6) % 7; if (k < 0) { k += 7; @@ -1564,10 +1569,10 @@ ClockGetenvObjCmd( ClientData clientData, Tcl_Interp* interp, int objc, - Tcl_Obj *CONST objv[]) + Tcl_Obj *const objv[]) { - CONST char* varName; - CONST char* varValue; + const char* varName; + const char* varValue; if (objc != 2) { Tcl_WrongNumArgs(interp, 1, objv, "name"); @@ -1601,7 +1606,7 @@ ClockGetenvObjCmd( static struct tm * ThreadSafeLocalTime( - CONST time_t *timePtr) /* Pointer to the number of seconds since the + const time_t *timePtr) /* Pointer to the number of seconds since the * local system's epoch */ { /* @@ -1651,9 +1656,9 @@ ClockClicksObjCmd( ClientData clientData, /* Client data is unused */ Tcl_Interp* interp, /* Tcl interpreter */ int objc, /* Parameter count */ - Tcl_Obj* CONST* objv) /* Parameter values */ + Tcl_Obj* const* objv) /* Parameter values */ { - static CONST char *clicksSwitches[] = { + static const char *clicksSwitches[] = { "-milliseconds", "-microseconds", NULL }; enum ClicksSwitch { @@ -1719,7 +1724,7 @@ ClockMillisecondsObjCmd( ClientData clientData, /* Client data is unused */ Tcl_Interp* interp, /* Tcl interpreter */ int objc, /* Parameter count */ - Tcl_Obj* CONST* objv) /* Parameter values */ + Tcl_Obj* const* objv) /* Parameter values */ { Tcl_Time now; @@ -1756,7 +1761,7 @@ ClockMicrosecondsObjCmd( ClientData clientData, /* Client data is unused */ Tcl_Interp* interp, /* Tcl interpreter */ int objc, /* Parameter count */ - Tcl_Obj* CONST* objv) /* Parameter values */ + Tcl_Obj* const* objv) /* Parameter values */ { Tcl_Time now; @@ -1793,7 +1798,7 @@ ClockSecondsObjCmd( ClientData clientData, /* Client data is unused */ Tcl_Interp* interp, /* Tcl interpreter */ int objc, /* Parameter count */ - Tcl_Obj* CONST* objv) /* Parameter values */ + Tcl_Obj* const* objv) /* Parameter values */ { Tcl_Time now; @@ -1828,7 +1833,7 @@ TzsetIfNecessary(void) { static char* tzWas = NULL; /* Previous value of TZ, protected by * clockMutex. */ - CONST char* tzIsNow; /* Current value of TZ */ + const char* tzIsNow; /* Current value of TZ */ Tcl_MutexLock(&clockMutex); tzIsNow = getenv("TZ"); diff --git a/generic/tclCmdAH.c b/generic/tclCmdAH.c index 99525ef..f2c49cb 100644 --- a/generic/tclCmdAH.c +++ b/generic/tclCmdAH.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: tclCmdAH.c,v 1.74 2006/06/20 13:22:59 dgp Exp $ + * RCS: @(#) $Id: tclCmdAH.c,v 1.75 2006/08/10 12:15:30 dkf Exp $ */ #include "tclInt.h" @@ -1784,12 +1784,12 @@ Tcl_ForeachObjCmd(dummy, interp, objc, objv) result = Tcl_ListObjGetElements(interp, argObjv[1+i*2], &varcList[i], &varvList[i]); if (result != TCL_OK) { - Tcl_Panic("Tcl_ForeachObjCmd: could not reconvert variable list %d to a list object\n", i); + Tcl_Panic("Tcl_ForeachObjCmd: could not reconvert variable list %d to a list object", i); } result = Tcl_ListObjGetElements(interp, argObjv[2+i*2], &argcList[i], &argvList[i]); if (result != TCL_OK) { - Tcl_Panic("Tcl_ForeachObjCmd: could not reconvert value list %d to a list object\n", i); + Tcl_Panic("Tcl_ForeachObjCmd: could not reconvert value list %d to a list object", i); } for (v=0 ; vtype != TCL_TOKEN_SUB_EXPR) { - Tcl_Panic("CompileSubExpr: token type %d not TCL_TOKEN_SUB_EXPR\n", + Tcl_Panic("CompileSubExpr: token type %d not TCL_TOKEN_SUB_EXPR", exprTokenPtr->type); } code = TCL_OK; @@ -497,14 +497,14 @@ CompileSubExpr( break; default: - Tcl_Panic("CompileSubExpr: unexpected operator %d requiring special treatment\n", + Tcl_Panic("CompileSubExpr: unexpected operator %d requiring special treatment", opIndex); } /* end switch on operator requiring special treatment */ infoPtr->hasOperators = 1; break; default: - Tcl_Panic("CompileSubExpr: unexpected token type %d\n", + Tcl_Panic("CompileSubExpr: unexpected token type %d", tokenPtr->type); } diff --git a/generic/tclCompile.c b/generic/tclCompile.c index 659a611..a24571b 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.93 2005/11/30 14:59:40 dkf Exp $ + * RCS: @(#) $Id: tclCompile.c,v 1.94 2006/08/10 12:15:31 dkf Exp $ */ #include "tclInt.h" @@ -1761,7 +1761,7 @@ TclInitByteCodeObj( #else nextPtr = EncodeCmdLocMap(envPtr, codePtr, (unsigned char *) p); if (((size_t)(nextPtr - p)) != cmdLocBytes) { - Tcl_Panic("TclInitByteCodeObj: encoded cmd location bytes %d != expected size %d\n", (nextPtr - p), cmdLocBytes); + Tcl_Panic("TclInitByteCodeObj: encoded cmd location bytes %d != expected size %d", (nextPtr - p), cmdLocBytes); } #endif @@ -1971,7 +1971,7 @@ EnterCmdStartData( CmdLocation *cmdLocPtr; if ((cmdIndex < 0) || (cmdIndex >= envPtr->numCommands)) { - Tcl_Panic("EnterCmdStartData: bad command index %d\n", cmdIndex); + Tcl_Panic("EnterCmdStartData: bad command index %d", cmdIndex); } if (cmdIndex >= envPtr->cmdMapEnd) { @@ -2048,11 +2048,11 @@ EnterCmdExtentData( CmdLocation *cmdLocPtr; if ((cmdIndex < 0) || (cmdIndex >= envPtr->numCommands)) { - Tcl_Panic("EnterCmdExtentData: bad command index %d\n", cmdIndex); + Tcl_Panic("EnterCmdExtentData: bad command index %d", cmdIndex); } if (cmdIndex > envPtr->cmdMapEnd) { - Tcl_Panic("EnterCmdExtentData: missing start data for command %d\n", + Tcl_Panic("EnterCmdExtentData: missing start data for command %d", cmdIndex); } @@ -2480,7 +2480,7 @@ TclFixupForwardJump( rangePtr->catchOffset += 3; break; default: - Tcl_Panic("TclFixupForwardJump: bad ExceptionRange type %d\n", + Tcl_Panic("TclFixupForwardJump: bad ExceptionRange type %d", rangePtr->type); } } @@ -2995,7 +2995,7 @@ TclPrintByteCodeObj( fprintf(stdout, "catch %d\n", rangePtr->catchOffset); break; default: - Tcl_Panic("TclPrintByteCodeObj: bad ExceptionRange type %d\n", + Tcl_Panic("TclPrintByteCodeObj: bad ExceptionRange type %d", rangePtr->type); } } @@ -3233,7 +3233,7 @@ TclPrintInstruction( printLVTindex: if (localPtr != NULL) { if (opnd >= localCt) { - Tcl_Panic("TclPrintInstruction: bad local var index %u (%u locals)\n", + Tcl_Panic("TclPrintInstruction: bad local var index %u (%u locals)", (unsigned int) opnd, localCt); } for (j = 0; j < opnd; j++) { diff --git a/generic/tclDictObj.c b/generic/tclDictObj.c index 390c66f..114d933 100644 --- a/generic/tclDictObj.c +++ b/generic/tclDictObj.c @@ -9,7 +9,7 @@ * See the file "license.terms" for information on usage and redistribution of * this file, and for a DISCLAIMER OF ALL WARRANTIES. * - * RCS: @(#) $Id: tclDictObj.c,v 1.40 2006/08/09 13:51:02 dkf Exp $ + * RCS: @(#) $Id: tclDictObj.c,v 1.41 2006/08/10 12:15:31 dkf Exp $ */ #include "tclInt.h" @@ -732,7 +732,7 @@ Tcl_DictObjPut( int isNew; if (Tcl_IsShared(dictPtr)) { - Tcl_Panic("Tcl_DictObjPut called with shared object"); + Tcl_Panic("%s called with shared object", "Tcl_DictObjPut"); } if (dictPtr->typePtr != &tclDictType) { @@ -833,7 +833,7 @@ Tcl_DictObjRemove( Tcl_HashEntry *hPtr; if (Tcl_IsShared(dictPtr)) { - Tcl_Panic("Tcl_DictObjRemove called with shared object"); + Tcl_Panic("%s called with shared object", "Tcl_DictObjRemove"); } if (dictPtr->typePtr != &tclDictType) { @@ -1107,10 +1107,10 @@ Tcl_DictObjPutKeyList( int isNew; if (Tcl_IsShared(dictPtr)) { - Tcl_Panic("Tcl_DictObjPutKeyList called with shared object"); + Tcl_Panic("%s called with shared object", "Tcl_DictObjPutKeyList"); } if (keyc < 1) { - Tcl_Panic("Tcl_DictObjPutKeyList called with empty key list"); + Tcl_Panic("%s called with empty key list", "Tcl_DictObjPutKeyList"); } dictPtr = TclTraceDictPath(interp, dictPtr, keyc-1,keyv, DICT_PATH_CREATE); @@ -1164,10 +1164,10 @@ Tcl_DictObjRemoveKeyList( Tcl_HashEntry *hPtr; if (Tcl_IsShared(dictPtr)) { - Tcl_Panic("Tcl_DictObjRemoveKeyList called with shared object"); + Tcl_Panic("%s called with shared object", "Tcl_DictObjRemoveKeyList"); } if (keyc < 1) { - Tcl_Panic("Tcl_DictObjRemoveKeyList called with empty key list"); + Tcl_Panic("%s called with empty key list", "Tcl_DictObjRemoveKeyList"); } dictPtr = TclTraceDictPath(interp, dictPtr, keyc-1,keyv, DICT_PATH_UPDATE); @@ -2982,7 +2982,7 @@ Tcl_DictObjCmd( case DICT_VALUES: return DictValuesCmd(interp, objc, objv); case DICT_WITH: return DictWithCmd(interp, objc, objv); } - Tcl_Panic("unexpected fallthrough!"); + Tcl_Panic("unexpected fallthrough"); /* * Next line is NOT REACHED - stops compliler complaint though... diff --git a/generic/tclExecute.c b/generic/tclExecute.c index 5e12c95..1ab1b02 100644 --- a/generic/tclExecute.c +++ b/generic/tclExecute.c @@ -12,7 +12,7 @@ * See the file "license.terms" for information on usage and redistribution of * this file, and for a DISCLAIMER OF ALL WARRANTIES. * - * RCS: @(#) $Id: tclExecute.c,v 1.240 2006/07/26 21:56:34 dgp Exp $ + * RCS: @(#) $Id: tclExecute.c,v 1.241 2006/08/10 12:15:31 dkf Exp $ */ #include "tclInt.h" @@ -153,14 +153,14 @@ long tclObjsShared[TCL_MAX_SHARED_OBJ_STATS] = { 0, 0, 0, 0, 0 }; switch (nCleanup) {\ case 1: goto cleanup1_pushObjResultPtr;\ case 2: goto cleanup2_pushObjResultPtr;\ - default: Tcl_Panic("ERROR: bad usage of macro NEXT_INST_F");\ + default: Tcl_Panic("bad usage of macro NEXT_INST_F");\ }\ } else {\ pc += (pcAdjustment);\ switch (nCleanup) {\ case 1: goto cleanup1;\ case 2: goto cleanup2;\ - default: Tcl_Panic("ERROR: bad usage of macro NEXT_INST_F");\ + default: Tcl_Panic("bad usage of macro NEXT_INST_F");\ }\ } @@ -502,7 +502,7 @@ TclDeleteExecEnv( if (eePtr->stackPtr[-1] == (Tcl_Obj *) ((char *) 1)) { ckfree((char *) (eePtr->stackPtr-1)); } else { - Tcl_Panic("ERROR: freeing an execEnv whose stack is still in use.\n"); + Tcl_Panic("freeing an execEnv whose stack is still in use"); } TclDecrRefCount(eePtr->constants[0]); TclDecrRefCount(eePtr->constants[1]); @@ -1040,7 +1040,7 @@ TclIncrObj( mp_int value, incr; if (Tcl_IsShared(valuePtr)) { - Tcl_Panic("shared object passed to TclIncrObj"); + Tcl_Panic("%s called with shared object", "TclIncrObj"); } if (GetNumberFromObj(NULL, valuePtr, &ptr1, &type1) != TCL_OK) { diff --git a/generic/tclHash.c b/generic/tclHash.c index 04159d8..3faadb9 100644 --- a/generic/tclHash.c +++ b/generic/tclHash.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: tclHash.c,v 1.24 2005/10/31 15:59:41 dkf Exp $ + * RCS: @(#) $Id: tclHash.c,v 1.25 2006/08/10 12:15:31 dkf Exp $ */ #include "tclInt.h" @@ -178,7 +178,7 @@ Tcl_InitCustomHashTable( * behaviour of this table. */ { #if (TCL_SMALL_HASH_TABLE != 4) - Tcl_Panic("Tcl_InitCustomHashTable: TCL_SMALL_HASH_TABLE is %d, not 4\n", + Tcl_Panic("Tcl_InitCustomHashTable: TCL_SMALL_HASH_TABLE is %d, not 4", TCL_SMALL_HASH_TABLE); #endif @@ -282,7 +282,7 @@ Tcl_FindHashEntry( #else typePtr = tablePtr->typePtr; if (typePtr == NULL) { - Tcl_Panic("called Tcl_FindHashEntry on deleted table"); + Tcl_Panic("called %s on deleted table", "Tcl_FindHashEntry"); return NULL; } #endif @@ -381,7 +381,7 @@ Tcl_CreateHashEntry( #else typePtr = tablePtr->typePtr; if (typePtr == NULL) { - Tcl_Panic("called Tcl_CreateHashEntry on deleted table"); + Tcl_Panic("called %s on deleted table", "Tcl_CreateHashEntry"); return NULL; } #endif @@ -753,7 +753,7 @@ Tcl_HashStats( #else typePtr = tablePtr->typePtr; if (typePtr == NULL) { - Tcl_Panic("called Tcl_HashStats on deleted table"); + Tcl_Panic("called %s on deleted table", "Tcl_HashStats"); return NULL; } #endif @@ -1072,7 +1072,7 @@ BogusFind( Tcl_HashTable *tablePtr, /* Table in which to lookup entry. */ CONST char *key) /* Key to use to find matching entry. */ { - Tcl_Panic("called Tcl_FindHashEntry on deleted table"); + Tcl_Panic("called %s on deleted table", "Tcl_FindHashEntry"); return NULL; } @@ -1102,7 +1102,7 @@ BogusCreate( int *newPtr) /* Store info here telling whether a new entry * was created. */ { - Tcl_Panic("called Tcl_CreateHashEntry on deleted table"); + Tcl_Panic("called %s on deleted table", "Tcl_CreateHashEntry"); return NULL; } #endif diff --git a/generic/tclListObj.c b/generic/tclListObj.c index d4da0e8..3329dae 100644 --- a/generic/tclListObj.c +++ b/generic/tclListObj.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: tclListObj.c,v 1.32 2006/07/20 06:17:39 das Exp $ + * RCS: @(#) $Id: tclListObj.c,v 1.33 2006/08/10 12:15:31 dkf Exp $ */ #include "tclInt.h" @@ -176,7 +176,7 @@ Tcl_NewListObj( listRepPtr = NewListIntRep(objc, objv); if (!listRepPtr) { - Tcl_Panic("Not enough memory to create the list\n"); + Tcl_Panic("Not enough memory to allocate list"); } /* @@ -248,7 +248,7 @@ Tcl_DbNewListObj( listRepPtr = NewListIntRep(objc, objv); if (!listRepPtr) { - Tcl_Panic("Not enough memory to create the list\n"); + Tcl_Panic("Not enough memory to allocate list"); } /* @@ -310,7 +310,7 @@ Tcl_SetListObj( List *listRepPtr; if (Tcl_IsShared(objPtr)) { - Tcl_Panic("Tcl_SetListObj called with shared object"); + Tcl_Panic("%s called with shared object", "Tcl_SetListObj"); } /* @@ -441,7 +441,7 @@ Tcl_ListObjAppendList( Tcl_Obj **objv; if (Tcl_IsShared(listPtr)) { - Tcl_Panic("Tcl_ListObjAppendList called with shared object"); + Tcl_Panic("%s called with shared object", "Tcl_ListObjAppendList"); } result = Tcl_ListObjLength(interp, listPtr, &listLen); @@ -500,7 +500,7 @@ Tcl_ListObjAppendElement( int numElems, numRequired, newMax, newSize, i; if (Tcl_IsShared(listPtr)) { - Tcl_Panic("Tcl_ListObjAppendElement called with shared object"); + Tcl_Panic("%s called with shared object", "Tcl_ListObjAppendElement"); } if (listPtr->typePtr != &tclListType) { int result, length; @@ -744,7 +744,7 @@ Tcl_ListObjReplace( int isShared; if (Tcl_IsShared(listPtr)) { - Tcl_Panic("Tcl_ListObjReplace called with shared object"); + Tcl_Panic("%s called with shared object", "Tcl_ListObjReplace"); } if (listPtr->typePtr != &tclListType) { int length; @@ -1320,7 +1320,7 @@ TclListObjSetElement( */ if (Tcl_IsShared(listPtr)) { - Tcl_Panic("Tcl_ListObjSetElement called with shared object"); + Tcl_Panic("%s called with shared object", "TclListObjSetElement"); } if (listPtr->typePtr != &tclListType) { int length; diff --git a/generic/tclLiteral.c b/generic/tclLiteral.c index a9ee861..949a3a2 100644 --- a/generic/tclLiteral.c +++ b/generic/tclLiteral.c @@ -13,7 +13,7 @@ * See the file "license.terms" for information on usage and redistribution of * this file, and for a DISCLAIMER OF ALL WARRANTIES. * - * RCS: @(#) $Id: tclLiteral.c,v 1.27 2005/11/01 15:30:52 dkf Exp $ + * RCS: @(#) $Id: tclLiteral.c,v 1.28 2006/08/10 12:15:31 dkf Exp $ */ #include "tclInt.h" @@ -61,7 +61,7 @@ TclInitLiteralTable( * supplied by the caller. */ { #if (TCL_SMALL_HASH_TABLE != 4) - Tcl_Panic("TclInitLiteralTable: TCL_SMALL_HASH_TABLE is %d, not 4\n", + Tcl_Panic("TclInitLiteralTable: TCL_SMALL_HASH_TABLE is %d, not 4", TCL_SMALL_HASH_TABLE); #endif diff --git a/generic/tclObj.c b/generic/tclObj.c index 5d1fe8a..3c5e3cf 100644 --- a/generic/tclObj.c +++ b/generic/tclObj.c @@ -12,7 +12,7 @@ * See the file "license.terms" for information on usage and redistribution of * this file, and for a DISCLAIMER OF ALL WARRANTIES. * - * RCS: @(#) $Id: tclObj.c,v 1.111 2006/07/21 14:56:14 dgp Exp $ + * RCS: @(#) $Id: tclObj.c,v 1.112 2006/08/10 12:15:31 dkf Exp $ */ #include "tclInt.h" @@ -1240,7 +1240,7 @@ Tcl_SetBooleanObj( register int boolValue) /* Boolean used to set object's value. */ { if (Tcl_IsShared(objPtr)) { - Tcl_Panic("Tcl_SetBooleanObj called with shared object"); + Tcl_Panic("%s called with shared object", "Tcl_SetBooleanObj"); } TclSetBooleanObj(objPtr, boolValue); @@ -1624,7 +1624,7 @@ Tcl_SetDoubleObj( register double dblValue) /* Double used to set the object's value. */ { if (Tcl_IsShared(objPtr)) { - Tcl_Panic("Tcl_SetDoubleObj called with shared object"); + Tcl_Panic("%s called with shared object", "Tcl_SetDoubleObj"); } TclSetDoubleObj(objPtr, dblValue); @@ -1830,7 +1830,7 @@ Tcl_SetIntObj( register int intValue) /* Integer used to set object's value. */ { if (Tcl_IsShared(objPtr)) { - Tcl_Panic("Tcl_SetIntObj called with shared object"); + Tcl_Panic("%s called with shared object", "Tcl_SetIntObj"); } TclSetIntObj(objPtr, intValue); @@ -2092,7 +2092,7 @@ Tcl_SetLongObj( * object's value. */ { if (Tcl_IsShared(objPtr)) { - Tcl_Panic("Tcl_SetLongObj called with shared object"); + Tcl_Panic("%s called with shared object", "Tcl_SetLongObj"); } TclSetLongObj(objPtr, longValue); @@ -2394,7 +2394,7 @@ Tcl_SetWideIntObj( * object's value. */ { if (Tcl_IsShared(objPtr)) { - Tcl_Panic("Tcl_SetWideIntObj called with shared object"); + Tcl_Panic("%s called with shared object", "Tcl_SetWideIntObj"); } if ((wideValue >= (Tcl_WideInt) LONG_MIN) @@ -2869,7 +2869,7 @@ Tcl_SetBignumObj( mp_int *bignumValue) /* Value to store */ { if (Tcl_IsShared(objPtr)) { - Tcl_Panic("Tcl_SetBignumObj called with shared object"); + Tcl_Panic("%s called with shared object", "Tcl_SetBignumObj"); } if ((size_t)(bignumValue->used) <= (CHAR_BIT * sizeof(long) + DIGIT_BIT - 1) / DIGIT_BIT) { @@ -3032,7 +3032,7 @@ Tcl_DbIncrRefCount( if (objPtr->refCount == 0x61616161) { fprintf(stderr, "file = %s, line = %d\n", file, line); fflush(stderr); - Tcl_Panic("Trying to increment refCount of previously disposed object."); + Tcl_Panic("incrementing refCount of previously disposed object"); } # ifdef TCL_THREADS @@ -3097,7 +3097,7 @@ Tcl_DbDecrRefCount( if (objPtr->refCount == 0x61616161) { fprintf(stderr, "file = %s, line = %d\n", file, line); fflush(stderr); - Tcl_Panic("Trying to decrement refCount of previously disposed object."); + Tcl_Panic("decrementing refCount of previously disposed object"); } # ifdef TCL_THREADS @@ -3168,7 +3168,7 @@ Tcl_DbIsShared( if (objPtr->refCount == 0x61616161) { fprintf(stderr, "file = %s, line = %d\n", file, line); fflush(stderr); - Tcl_Panic("Trying to check whether previously disposed object is shared."); + Tcl_Panic("checking whether previously disposed object is shared"); } # ifdef TCL_THREADS diff --git a/generic/tclPreserve.c b/generic/tclPreserve.c index f4dcedc..a721bb7 100644 --- a/generic/tclPreserve.c +++ b/generic/tclPreserve.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: tclPreserve.c,v 1.8 2005/11/07 15:12:26 dkf Exp $ + * RCS: @(#) $Id: tclPreserve.c,v 1.9 2006/08/10 12:15:31 dkf Exp $ */ #include "tclInt.h" @@ -292,7 +292,7 @@ Tcl_EventuallyFree( continue; } if (refPtr->mustFree) { - Tcl_Panic("Tcl_EventuallyFree called twice for 0x%x\n", + Tcl_Panic("Tcl_EventuallyFree called twice for 0x%x", clientData); } refPtr->mustFree = 1; diff --git a/generic/tclStrToD.c b/generic/tclStrToD.c index 7d03c2b..5e5f974 100755 --- a/generic/tclStrToD.c +++ b/generic/tclStrToD.c @@ -14,7 +14,7 @@ * See the file "license.terms" for information on usage and redistribution of * this file, and for a DISCLAIMER OF ALL WARRANTIES. * - * RCS: @(#) $Id: tclStrToD.c,v 1.24 2006/07/20 06:17:39 das Exp $ + * RCS: @(#) $Id: tclStrToD.c,v 1.25 2006/08/10 12:15:31 dkf Exp $ * *---------------------------------------------------------------------- */ @@ -2199,7 +2199,7 @@ TclInitDoubleConversion(void) } else if ((bitwhack.iv & 0xffffffff) == 0x3ff00000) { n770_fp = 1; } else { - Tcl_Panic("unknown floating point word order on this machine."); + Tcl_Panic("unknown floating point word order on this machine"); } #endif } diff --git a/generic/tclStringObj.c b/generic/tclStringObj.c index 953cacb..e0af618 100644 --- a/generic/tclStringObj.c +++ b/generic/tclStringObj.c @@ -33,7 +33,7 @@ * See the file "license.terms" for information on usage and redistribution of * this file, and for a DISCLAIMER OF ALL WARRANTIES. * - * RCS: @(#) $Id: tclStringObj.c,v 1.54 2006/07/20 06:17:39 das Exp $ */ + * RCS: @(#) $Id: tclStringObj.c,v 1.55 2006/08/10 12:15:31 dkf Exp $ */ #include "tclInt.h" #include "tommath.h" @@ -698,7 +698,7 @@ Tcl_SetStringObj( */ if (Tcl_IsShared(objPtr)) { - Tcl_Panic("Tcl_SetStringObj called with shared object"); + Tcl_Panic("%s called with shared object", "Tcl_SetStringObj"); } /* @@ -749,7 +749,7 @@ Tcl_SetObjLength( String *stringPtr; if (Tcl_IsShared(objPtr)) { - Tcl_Panic("Tcl_SetObjLength called with shared object"); + Tcl_Panic("%s called with shared object", "Tcl_SetObjLength"); } SetStringFromAny(NULL, objPtr); @@ -865,7 +865,7 @@ Tcl_AttemptSetObjLength( String *stringPtr; if (Tcl_IsShared(objPtr)) { - Tcl_Panic("Tcl_AttemptSetObjLength called with shared object"); + Tcl_Panic("%s called with shared object", "Tcl_AttemptSetObjLength"); } SetStringFromAny(NULL, objPtr); @@ -1054,7 +1054,7 @@ TclAppendLimitedToObj( int toCopy = 0; if (Tcl_IsShared(objPtr)) { - Tcl_Panic("TclAppendLimitedToObj called with shared object"); + Tcl_Panic("%s called with shared object", "TclAppendLimitedToObj"); } SetStringFromAny(NULL, objPtr); @@ -1156,7 +1156,7 @@ Tcl_AppendUnicodeToObj( String *stringPtr; if (Tcl_IsShared(objPtr)) { - Tcl_Panic("Tcl_AppendUnicodeToObj called with shared object"); + Tcl_Panic("%s called with shared object", "Tcl_AppendUnicodeToObj"); } if (length == 0) { @@ -1533,7 +1533,7 @@ Tcl_AppendStringsToObjVA( int nargs, i; if (Tcl_IsShared(objPtr)) { - Tcl_Panic("Tcl_AppendStringsToObj called with shared object"); + Tcl_Panic("%s called with shared object", "Tcl_AppendStringsToObj"); } SetStringFromAny(NULL, objPtr); @@ -1715,7 +1715,7 @@ TclAppendFormattedObjs( }; if (Tcl_IsShared(appendObj)) { - Tcl_Panic("TclAppendFormattedObjs called with shared object"); + Tcl_Panic("%s called with shared object", "TclAppendFormattedObjs"); } Tcl_GetStringFromObj(appendObj, &originalLength); diff --git a/generic/tclThreadAlloc.c b/generic/tclThreadAlloc.c index 9c77910..c0bb338 100755 --- a/generic/tclThreadAlloc.c +++ b/generic/tclThreadAlloc.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: tclThreadAlloc.c,v 1.20 2005/12/20 22:16:48 dkf Exp $ + * RCS: @(#) $Id: tclThreadAlloc.c,v 1.21 2006/08/10 12:15:31 dkf Exp $ */ #include "tclInt.h" @@ -735,12 +735,12 @@ Ptr2Block( blockPtr = (((Block *) ptr) - 1); if (blockPtr->magicNum1 != MAGIC || blockPtr->magicNum2 != MAGIC) { - Tcl_Panic("alloc: invalid block: %p: %x %x\n", + Tcl_Panic("alloc: invalid block: %p: %x %x", blockPtr, blockPtr->magicNum1, blockPtr->magicNum2); } #if RCHECK if (((unsigned char *) ptr)[blockPtr->reqSize] != MAGIC) { - Tcl_Panic("alloc: invalid block: %p: %x %x %x\n", + Tcl_Panic("alloc: invalid block: %p: %x %x %x", blockPtr, blockPtr->magicNum1, blockPtr->magicNum2, ((unsigned char *) ptr)[blockPtr->reqSize]); } @@ -1009,7 +1009,7 @@ TclFinalizeThreadAlloc(void) void TclFinalizeThreadAlloc(void) { - Tcl_Panic("TclFinalizeThreadAlloc called when threaded memory allocator not in use."); + Tcl_Panic("TclFinalizeThreadAlloc called when threaded memory allocator not in use"); } #endif /* TCL_THREADS */ diff --git a/generic/tclUtil.c b/generic/tclUtil.c index da57e34..3ab3a14 100644 --- a/generic/tclUtil.c +++ b/generic/tclUtil.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: tclUtil.c,v 1.68 2005/11/02 11:55:47 dkf Exp $ + * RCS: @(#) $Id: tclUtil.c,v 1.69 2006/08/10 12:15:31 dkf Exp $ */ #include "tclInt.h" @@ -2779,7 +2779,7 @@ TclGetProcessGlobalValue( (*(pgvPtr->proc))(&pgvPtr->value, &pgvPtr->numBytes, &pgvPtr->encoding); if (pgvPtr->value == NULL) { - Tcl_Panic("PGV Initializer did not initialize."); + Tcl_Panic("PGV Initializer did not initialize"); } Tcl_CreateExitHandler(FreeProcessGlobalValue, (ClientData) pgvPtr); } diff --git a/generic/tclVar.c b/generic/tclVar.c index 50b02b3..e3daeff 100644 --- a/generic/tclVar.c +++ b/generic/tclVar.c @@ -15,7 +15,7 @@ * See the file "license.terms" for information on usage and redistribution of * this file, and for a DISCLAIMER OF ALL WARRANTIES. * - * RCS: @(#) $Id: tclVar.c,v 1.120 2006/02/09 17:34:42 dgp Exp $ + * RCS: @(#) $Id: tclVar.c,v 1.121 2006/08/10 12:15:31 dkf Exp $ */ #include "tclInt.h" @@ -2208,11 +2208,7 @@ Tcl_UnsetObjCmd( register int i, flags = TCL_LEAVE_ERR_MSG; register char *name; - if (objc < 1) { - Tcl_WrongNumArgs(interp, 1, objv, - "?-nocomplain? ?--? ?varName varName ...?"); - return TCL_ERROR; - } else if (objc == 1) { + if (objc == 1) { /* * Do nothing if no arguments supplied, so as to match command * documentation. @@ -3290,7 +3286,7 @@ TclPtrMakeUpvar( if (index >= 0) { if (!(varFramePtr->isProcCallFrame & FRAME_IS_PROC)) { - Tcl_Panic("ObjMakeUpvar called with an index outside from a proc.\n"); + Tcl_Panic("ObjMakeUpvar called with an index outside from a proc"); } varPtr = &(varFramePtr->compiledLocals[index]); } else { @@ -4536,7 +4532,7 @@ static void PanicOnUpdateVarName( Tcl_Obj *objPtr) { - Tcl_Panic("ERROR: updateStringProc of type %s should not be called.", + Tcl_Panic("%s of type %s should not be called", "updateStringProc", objPtr->typePtr->name); } @@ -4545,7 +4541,7 @@ PanicOnSetVarName( Tcl_Interp *interp, Tcl_Obj *objPtr) { - Tcl_Panic("ERROR: setFromAnyProc of type %s should not be called.", + Tcl_Panic("%s of type %s should not be called", "setFromAnyProc", objPtr->typePtr->name); return TCL_ERROR; } @@ -4664,7 +4660,7 @@ UpdateParsedVarName( * This is a parsed scalar name: what is it doing here? */ - Tcl_Panic("ERROR: scalar parsedVarName without a string rep.\n"); + Tcl_Panic("scalar parsedVarName without a string rep"); } part1 = Tcl_GetStringFromObj(arrayPtr, &len1); diff --git a/macosx/tclMacOSXNotify.c b/macosx/tclMacOSXNotify.c index 6d892ea..6dfb379 100644 --- a/macosx/tclMacOSXNotify.c +++ b/macosx/tclMacOSXNotify.c @@ -13,7 +13,7 @@ * See the file "license.terms" for information on usage and redistribution of * this file, and for a DISCLAIMER OF ALL WARRANTIES. * - * RCS: @(#) $Id: tclMacOSXNotify.c,v 1.8 2006/07/20 06:18:37 das Exp $ + * RCS: @(#) $Id: tclMacOSXNotify.c,v 1.9 2006/08/10 12:15:32 dkf Exp $ */ #include "tclInt.h" @@ -179,7 +179,7 @@ static void SpinLockLockInit(void) { lockLock = OSSpinLockLock != NULL ? OSSpinLockLock : _spin_lock; lockUnlock = OSSpinLockUnlock != NULL ? OSSpinLockUnlock : _spin_unlock; if (lockLock == NULL || lockUnlock == NULL) { - Tcl_Panic("SpinLockLockInit: no spinlock API available."); + Tcl_Panic("SpinLockLockInit: no spinlock API available"); } } #define SpinLockLock(p) lockLock(p) @@ -284,7 +284,7 @@ Tcl_InitNotifier(void) * Initialize support for weakly imported spinlock API. */ if (pthread_once(&spinLockLockInitControl, SpinLockLockInit)) { - Tcl_Panic("Tcl_InitNotifier: pthread_once failed."); + Tcl_Panic("Tcl_InitNotifier: pthread_once failed"); } #endif @@ -301,7 +301,7 @@ Tcl_InitNotifier(void) runLoopSourceContext.info = tsdPtr; runLoopSource = CFRunLoopSourceCreate(NULL, 0, &runLoopSourceContext); if (!runLoopSource) { - Tcl_Panic("Tcl_InitNotifier: could not create CFRunLoopSource."); + Tcl_Panic("Tcl_InitNotifier: could not create CFRunLoopSource"); } CFRunLoopAddSource(runLoop, runLoopSource, kCFRunLoopCommonModes); tsdPtr->runLoopSource = runLoopSource; @@ -321,8 +321,8 @@ Tcl_InitNotifier(void) #endif !atForkInit) { int result = pthread_atfork(AtForkPrepare, AtForkParent, AtForkChild); - if (result) { - Tcl_Panic("Tcl_InitNotifier: pthread_atfork failed."); + if (result) { + Tcl_Panic("Tcl_InitNotifier: pthread_atfork failed"); } atForkInit = 1; } @@ -335,18 +335,18 @@ Tcl_InitNotifier(void) */ if (pipe(fds) != 0) { - Tcl_Panic("Tcl_InitNotifier: could not create trigger pipe."); + Tcl_Panic("Tcl_InitNotifier: could not create trigger pipe"); } status = fcntl(fds[0], F_GETFL); status |= O_NONBLOCK; if (fcntl(fds[0], F_SETFL, status) < 0) { - Tcl_Panic("Tcl_InitNotifier: could not make receive pipe non blocking."); + Tcl_Panic("Tcl_InitNotifier: could not make receive pipe non blocking"); } status = fcntl(fds[1], F_GETFL); status |= O_NONBLOCK; if (fcntl(fds[1], F_SETFL, status) < 0) { - Tcl_Panic("Tcl_InitNotifier: could not make trigger pipe non blocking."); + Tcl_Panic("Tcl_InitNotifier: could not make trigger pipe non blocking"); } receivePipe = fds[0]; @@ -357,7 +357,7 @@ Tcl_InitNotifier(void) * interfering with fork() followed immediately by execve() * (cannot execve() when more than one thread is present). */ - + notifierThread = 0; } notifierCount++; @@ -402,7 +402,7 @@ Tcl_FinalizeNotifier( int result; if (triggerPipe < 0) { - Tcl_Panic("Tcl_FinalizeNotifier: notifier pipe not initialized."); + Tcl_Panic("Tcl_FinalizeNotifier: notifier pipe not initialized"); } /* @@ -422,7 +422,7 @@ Tcl_FinalizeNotifier( if (notifierThread) { result = pthread_join(notifierThread, NULL); if (result) { - Tcl_Panic("Tcl_FinalizeNotifier: unable to join notifier thread."); + Tcl_Panic("Tcl_FinalizeNotifier: unable to join notifier thread"); } notifierThread = 0; } @@ -844,7 +844,7 @@ Tcl_WaitForEvent( (void * (*)(void *))NotifierThreadProc, NULL); pthread_attr_destroy(&attr); if (result || !notifierThread) { - Tcl_Panic("Tcl_WaitForEvent: unable to start notifier thread."); + Tcl_Panic("Tcl_WaitForEvent: unable to start notifier thread"); } } UNLOCK_NOTIFIER_INIT; @@ -1224,14 +1224,16 @@ AtForkChild(void) } if (notifierCount > 0) { notifierCount = 0; + /* - * Assume that the return value of Tcl_InitNotifier() in the child - * will be identical to the one stored as clientData in tclNotify.c's - * ThreadSpecificData by the parent's TclInitNotifier(), so discard - * the return value here. This assumption may require the fork() to - * be executed in the main thread of the parent, otherwise - * Tcl_AlertNotifier() may break in the child. + * Assume that the return value of Tcl_InitNotifier in the child will + * be identical to the one stored as clientData in tclNotify.c's + * ThreadSpecificData by the parent's TclInitNotifier, so discard the + * return value here. This assumption may require the fork() to be + * executed in the main thread of the parent, otherwise + * Tcl_AlertNotifier may break in the child. */ + Tcl_InitNotifier(); } } diff --git a/unix/tclUnixNotfy.c b/unix/tclUnixNotfy.c index fb51d1b..0a405ce 100644 --- a/unix/tclUnixNotfy.c +++ b/unix/tclUnixNotfy.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: tclUnixNotfy.c,v 1.30 2005/11/27 02:33:50 das Exp $ + * RCS: @(#) $Id: tclUnixNotfy.c,v 1.31 2006/08/10 12:15:32 dkf Exp $ */ #include "tclInt.h" @@ -278,7 +278,7 @@ Tcl_FinalizeNotifier( int result; if (triggerPipe < 0) { - Tcl_Panic("Tcl_FinalizeNotifier: notifier pipe not initialized."); + Tcl_Panic("Tcl_FinalizeNotifier: notifier pipe not initialized"); } /* @@ -300,7 +300,7 @@ Tcl_FinalizeNotifier( result = Tcl_JoinThread(notifierThread, NULL); if (result) { - Tcl_Panic("Tcl_FinalizeNotifier: unable to join notifier thread."); + Tcl_Panic("Tcl_FinalizeNotifier: unable to join notifier thread"); } } @@ -903,7 +903,7 @@ NotifierThreadProc( char buf[2]; if (pipe(fds) != 0) { - Tcl_Panic("NotifierThreadProc: could not create trigger pipe."); + Tcl_Panic("NotifierThreadProc: could not create trigger pipe"); } receivePipe = fds[0]; @@ -912,19 +912,19 @@ NotifierThreadProc( status = fcntl(receivePipe, F_GETFL); status |= O_NONBLOCK; if (fcntl(receivePipe, F_SETFL, status) < 0) { - Tcl_Panic("NotifierThreadProc: could not make receive pipe non blocking."); + Tcl_Panic("NotifierThreadProc: could not make receive pipe non blocking"); } status = fcntl(fds[1], F_GETFL); status |= O_NONBLOCK; if (fcntl(fds[1], F_SETFL, status) < 0) { - Tcl_Panic("NotifierThreadProc: could not make trigger pipe non blocking."); + Tcl_Panic("NotifierThreadProc: could not make trigger pipe non blocking"); } #else if (ioctl(receivePipe, (int) FIONBIO, &status) < 0) { - Tcl_Panic("NotifierThreadProc: could not make receive pipe non blocking."); + Tcl_Panic("NotifierThreadProc: could not make receive pipe non blocking"); } if (ioctl(fds[1], (int) FIONBIO, &status) < 0) { - Tcl_Panic("NotifierThreadProc: could not make trigger pipe non blocking."); + Tcl_Panic("NotifierThreadProc: could not make trigger pipe non blocking"); } #endif /* FIONBIO */ diff --git a/win/tclWinThrd.c b/win/tclWinThrd.c index 66a685c..98137c4 100644 --- a/win/tclWinThrd.c +++ b/win/tclWinThrd.c @@ -9,7 +9,7 @@ * See the file "license.terms" for information on usage and redistribution of * this file, and for a DISCLAIMER OF ALL WARRANTIES. * - * RCS: @(#) $Id: tclWinThrd.c,v 1.41 2005/11/04 00:06:51 dkf Exp $ + * RCS: @(#) $Id: tclWinThrd.c,v 1.42 2006/08/10 12:15:32 dkf Exp $ */ #include "tclWinInt.h" @@ -912,7 +912,7 @@ TclpGetAllocCache(void) result = TlsGetValue(tlsKey); if ((result == NULL) && (GetLastError() != NO_ERROR)) { - Tcl_Panic("TlsGetValue failed from TclpGetAllocCache!"); + Tcl_Panic("TlsGetValue failed from TclpGetAllocCache"); } return result; } @@ -924,7 +924,7 @@ TclpSetAllocCache( BOOL success; success = TlsSetValue(tlsKey, ptr); if (!success) { - Tcl_Panic("TlsSetValue failed from TclpSetAllocCache!"); + Tcl_Panic("TlsSetValue failed from TclpSetAllocCache"); } } @@ -943,7 +943,7 @@ TclpFreeAllocCache( TclFreeAllocCache(ptr); success = TlsSetValue(tlsKey, NULL); if (!success) { - Tcl_Panic("TlsSetValue failed from TclpFreeAllocCache!"); + Tcl_Panic("TlsSetValue failed from TclpFreeAllocCache"); } } else if (once) { /* @@ -953,7 +953,7 @@ TclpFreeAllocCache( success = TlsFree(tlsKey); if (!success) { - Tcl_Panic("TlsFree failed from TclpFreeAllocCache!"); + Tcl_Panic("TlsFree failed from TclpFreeAllocCache"); } once = 0; /* reset for next time. */ } -- cgit v0.12