From 245ed0c3c358f72b7b1c4591a0a8e1de80c0fb42 Mon Sep 17 00:00:00 2001 From: sebres Date: Tue, 21 May 2019 11:22:36 +0000 Subject: cherry-picing of [3f693cdfe9c875c4] to be more compatible across version, resolve mistake with "key objects/pointers comparison by the hash entry" firstly introduced there. --- generic/tclHash.c | 5 ++++- generic/tclObj.c | 7 +++---- 2 files changed, 7 insertions(+), 5 deletions(-) diff --git a/generic/tclHash.c b/generic/tclHash.c index 5d6ea86..837a167 100644 --- a/generic/tclHash.c +++ b/generic/tclHash.c @@ -324,7 +324,10 @@ CreateHashEntry( continue; } #endif - if (compareKeysProc((VOID *) key, hPtr)) { + /* if keys pointers or values are equal */ + if (((void *) key == hPtr->key.oneWordValue) + || compareKeysProc((VOID *) key, hPtr) + ) { if (newPtr) { *newPtr = 0; } diff --git a/generic/tclObj.c b/generic/tclObj.c index a283dd8..1738985 100644 --- a/generic/tclObj.c +++ b/generic/tclObj.c @@ -3921,11 +3921,10 @@ TclCompareObjKeys( /* * If the object pointers are the same then they match. - */ + * OPT: this comparison was moved to the caller - if (objPtr1 == objPtr2) { - return 1; - } + if (objPtr1 == objPtr2) return 1; + */ /* * Don't use Tcl_GetStringFromObj as it would prevent l1 and l2 being -- cgit v0.12