summaryrefslogtreecommitdiffstats
path: root/generic/tclBasic.c
diff options
context:
space:
mode:
authorjan.nijtmans <nijtmans@users.sourceforge.net>2021-12-16 09:14:33 (GMT)
committerjan.nijtmans <nijtmans@users.sourceforge.net>2021-12-16 09:14:33 (GMT)
commitc47479ba6c67cf43f292330459141c46ecc8186b (patch)
tree0a163c53c9df8c0d9bb5f510fcb2e030e3373fa0 /generic/tclBasic.c
parent45a9461fda336f79a4f493d92cf07164c48cbf44 (diff)
parentfcc9c57804bed50e0acafd815c13b3426cb3f3d2 (diff)
downloadtcl-c47479ba6c67cf43f292330459141c46ecc8186b.zip
tcl-c47479ba6c67cf43f292330459141c46ecc8186b.tar.gz
tcl-c47479ba6c67cf43f292330459141c46ecc8186b.tar.bz2
Merge 8.6
Diffstat (limited to 'generic/tclBasic.c')
-rw-r--r--generic/tclBasic.c12
1 files changed, 7 insertions, 5 deletions
diff --git a/generic/tclBasic.c b/generic/tclBasic.c
index 29392d2..45a430f 100644
--- a/generic/tclBasic.c
+++ b/generic/tclBasic.c
@@ -4001,7 +4001,9 @@ Tcl_CreateMathFunc(
data->proc = proc;
data->numArgs = numArgs;
data->argTypes = (Tcl_ValueType *)ckalloc(numArgs * sizeof(Tcl_ValueType));
- memcpy(data->argTypes, argTypes, numArgs * sizeof(Tcl_ValueType));
+ if ((numArgs > 0) && (argTypes != NULL)) {
+ memcpy(data->argTypes, argTypes, numArgs * sizeof(Tcl_ValueType));
+ }
data->clientData = clientData;
Tcl_DStringInit(&bigName);
@@ -8299,15 +8301,15 @@ ExprRandFunc(
* take into consideration the thread this interp is running in.
*/
- iPtr->randSeed = TclpGetClicks() + (PTR2INT(Tcl_GetCurrentThread())<<12);
+ iPtr->randSeed = TclpGetClicks() + PTR2UINT(Tcl_GetCurrentThread())*4093U;
/*
* Make sure 1 <= randSeed <= (2^31) - 2. See below.
*/
- iPtr->randSeed &= 0x7FFFFFFF;
- if ((iPtr->randSeed == 0) || (iPtr->randSeed == 0x7FFFFFFF)) {
- iPtr->randSeed ^= 123459876;
+ iPtr->randSeed &= 0x7FFFFFFFL;
+ if ((iPtr->randSeed == 0) || (iPtr->randSeed == 0x7FFFFFFFL)) {
+ iPtr->randSeed ^= 123459876L;
}
}