| ︙ | | | ︙ | |
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
|
*
*----------------------------------------------------------------------
*/
static Tcl_HashEntry *
AllocArrayEntry(
Tcl_HashTable *tablePtr, /* Hash table. */
void *keyPtr) /* Key to store in the hash table entry. */
{
Tcl_HashEntry *hPtr;
size_t count = tablePtr->keyType * sizeof(int);
size_t size = offsetof(Tcl_HashEntry, key) + count;
if (size < sizeof(Tcl_HashEntry)) {
size = sizeof(Tcl_HashEntry);
|
|
|
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
|
*
*----------------------------------------------------------------------
*/
static Tcl_HashEntry *
AllocArrayEntry(
Tcl_HashTable *tablePtr, /* Hash table. */
void *keyPtr) /* Key to store in the hash table entry. */
{
Tcl_HashEntry *hPtr;
size_t count = tablePtr->keyType * sizeof(int);
size_t size = offsetof(Tcl_HashEntry, key) + count;
if (size < sizeof(Tcl_HashEntry)) {
size = sizeof(Tcl_HashEntry);
|
| ︙ | | | ︙ | |
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
|
* None.
*
*----------------------------------------------------------------------
*/
static int
CompareArrayKeys(
void *keyPtr, /* New key to compare. */
Tcl_HashEntry *hPtr) /* Existing key to compare. */
{
size_t count = hPtr->tablePtr->keyType * sizeof(int);
return !memcmp(keyPtr, hPtr->key.string, count);
}
|
|
|
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
|
* None.
*
*----------------------------------------------------------------------
*/
static int
CompareArrayKeys(
void *keyPtr, /* New key to compare. */
Tcl_HashEntry *hPtr) /* Existing key to compare. */
{
size_t count = hPtr->tablePtr->keyType * sizeof(int);
return !memcmp(keyPtr, hPtr->key.string, count);
}
|
| ︙ | | | ︙ | |
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
|
*
*----------------------------------------------------------------------
*/
static size_t
HashArrayKey(
Tcl_HashTable *tablePtr, /* Hash table. */
void *keyPtr) /* Key from which to compute hash value. */
{
const int *array = (const int *) keyPtr;
size_t result;
int count;
for (result = 0, count = tablePtr->keyType; count > 0;
count--, array++) {
|
|
|
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
|
*
*----------------------------------------------------------------------
*/
static size_t
HashArrayKey(
Tcl_HashTable *tablePtr, /* Hash table. */
void *keyPtr) /* Key from which to compute hash value. */
{
const int *array = (const int *) keyPtr;
size_t result;
int count;
for (result = 0, count = tablePtr->keyType; count > 0;
count--, array++) {
|
| ︙ | | | ︙ | |
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
|
*
*----------------------------------------------------------------------
*/
static Tcl_HashEntry *
AllocStringEntry(
TCL_UNUSED(Tcl_HashTable *),
void *keyPtr) /* Key to store in the hash table entry. */
{
const char *string = (const char *) keyPtr;
Tcl_HashEntry *hPtr;
size_t size, allocsize;
allocsize = size = strlen(string) + 1;
if (size < sizeof(hPtr->key)) {
|
|
|
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
|
*
*----------------------------------------------------------------------
*/
static Tcl_HashEntry *
AllocStringEntry(
TCL_UNUSED(Tcl_HashTable *),
void *keyPtr) /* Key to store in the hash table entry. */
{
const char *string = (const char *) keyPtr;
Tcl_HashEntry *hPtr;
size_t size, allocsize;
allocsize = size = strlen(string) + 1;
if (size < sizeof(hPtr->key)) {
|
| ︙ | | | ︙ | |
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
|
* None.
*
*----------------------------------------------------------------------
*/
static int
CompareStringKeys(
void *keyPtr, /* New key to compare. */
Tcl_HashEntry *hPtr) /* Existing key to compare. */
{
return !strcmp((char *)keyPtr, hPtr->key.string);
}
/*
*----------------------------------------------------------------------
|
|
|
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
|
* None.
*
*----------------------------------------------------------------------
*/
static int
CompareStringKeys(
void *keyPtr, /* New key to compare. */
Tcl_HashEntry *hPtr) /* Existing key to compare. */
{
return !strcmp((char *)keyPtr, hPtr->key.string);
}
/*
*----------------------------------------------------------------------
|
| ︙ | | | ︙ | |
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
|
*
*----------------------------------------------------------------------
*/
static size_t
HashStringKey(
TCL_UNUSED(Tcl_HashTable *),
void *keyPtr) /* Key from which to compute hash value. */
{
const char *string = (const char *)keyPtr;
size_t result;
char c;
/*
* I tried a zillion different hash functions and asked many other people
|
|
|
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
|
*
*----------------------------------------------------------------------
*/
static size_t
HashStringKey(
TCL_UNUSED(Tcl_HashTable *),
void *keyPtr) /* Key from which to compute hash value. */
{
const char *string = (const char *)keyPtr;
size_t result;
char c;
/*
* I tried a zillion different hash functions and asked many other people
|
| ︙ | | | ︙ | |