diff options
| author | dkf <donal.k.fellows@manchester.ac.uk> | 2023-05-01 13:22:24 (GMT) |
|---|---|---|
| committer | dkf <donal.k.fellows@manchester.ac.uk> | 2023-05-01 13:22:24 (GMT) |
| commit | 530e4b3bb9e1b9acd0231c4da1a29d73180a20d5 (patch) | |
| tree | d32275c10833e1cca203e0c05f52340d30682262 /generic/tclThreadTest.c | |
| parent | 528b7b71686a0bb1993b1cce1166b5b70d511d31 (diff) | |
| parent | 6c4b78cfa8c06ea5963591778902da74850d1985 (diff) | |
| download | tcl-530e4b3bb9e1b9acd0231c4da1a29d73180a20d5.zip tcl-530e4b3bb9e1b9acd0231c4da1a29d73180a20d5.tar.gz tcl-530e4b3bb9e1b9acd0231c4da1a29d73180a20d5.tar.bz2 | |
Merge 8.7
Diffstat (limited to 'generic/tclThreadTest.c')
| -rw-r--r-- | generic/tclThreadTest.c | 23 |
1 files changed, 11 insertions, 12 deletions
diff --git a/generic/tclThreadTest.c b/generic/tclThreadTest.c index cf9d0da..44d2b0e 100644 --- a/generic/tclThreadTest.c +++ b/generic/tclThreadTest.c @@ -119,9 +119,7 @@ static char *errorProcString; TCL_DECLARE_MUTEX(threadMutex) -static int ThreadObjCmd(void *clientData, - Tcl_Interp *interp, int objc, - Tcl_Obj *const objv[]); +static Tcl_ObjCmdProc ThreadObjCmd; static int ThreadCreate(Tcl_Interp *interp, const char *script, int joinable); static int ThreadList(Tcl_Interp *interp); @@ -275,7 +273,8 @@ ThreadObjCmd( } case THREAD_CREATE: { const char *script; - int joinable, len; + int joinable; + Tcl_Size len; if (objc == 2) { /* @@ -370,7 +369,7 @@ ThreadObjCmd( } else { char buf[TCL_INTEGER_SPACE]; - sprintf(buf, "%" TCL_LL_MODIFIER "d", (long long)id); + snprintf(buf, sizeof(buf), "%" TCL_LL_MODIFIER "d", (long long)id); Tcl_AppendResult(interp, "cannot join thread ", buf, NULL); } return result; @@ -610,7 +609,7 @@ NewTestThread( */ Tcl_Preserve(tsdPtr->interp); - result = Tcl_EvalEx(tsdPtr->interp, threadEvalScript, -1, 0); + result = Tcl_EvalEx(tsdPtr->interp, threadEvalScript, TCL_INDEX_NONE, 0); if (result != TCL_OK) { ThreadErrorProc(tsdPtr->interp); } @@ -652,15 +651,15 @@ ThreadErrorProc( char *script; char buf[TCL_DOUBLE_SPACE+1]; - sprintf(buf, "%p", Tcl_GetCurrentThread()); + snprintf(buf, sizeof(buf), "%p", Tcl_GetCurrentThread()); errorInfo = Tcl_GetVar2(interp, "errorInfo", NULL, TCL_GLOBAL_ONLY); if (errorProcString == NULL) { errChannel = Tcl_GetStdChannel(TCL_STDERR); - Tcl_WriteChars(errChannel, "Error from thread ", -1); - Tcl_WriteChars(errChannel, buf, -1); + Tcl_WriteChars(errChannel, "Error from thread ", TCL_INDEX_NONE); + Tcl_WriteChars(errChannel, buf, TCL_INDEX_NONE); Tcl_WriteChars(errChannel, "\n", 1); - Tcl_WriteChars(errChannel, errorInfo, -1); + Tcl_WriteChars(errChannel, errorInfo, TCL_INDEX_NONE); Tcl_WriteChars(errChannel, "\n", 1); } else { argv[0] = errorProcString; @@ -825,7 +824,7 @@ ThreadSend( } /* - * Short circut sends to ourself. Ought to do something with -async, like + * Short circuit sends to ourself. Ought to do something with -async, like * run in an idle handler. */ @@ -985,7 +984,7 @@ ThreadCancel( Tcl_MutexUnlock(&threadMutex); Tcl_ResetResult(interp); return Tcl_CancelEval(tsdPtr->interp, - (result != NULL) ? Tcl_NewStringObj(result, -1) : NULL, 0, flags); + (result != NULL) ? Tcl_NewStringObj(result, TCL_INDEX_NONE) : NULL, 0, flags); } /* |
