From dd9543080159970fb0c26a9b67d655c72c7ea02c Mon Sep 17 00:00:00 2001 From: Guido van Rossum Date: Fri, 14 Feb 1997 16:29:22 +0000 Subject: Slight tweak: in string_hash(), if the hash hasn't been computed yet, and if there's a pointer to an interned version of the string, use its hash and store its hash in this object, rather than recomputing it. --- Objects/stringobject.c | 5 +++++ 1 file changed, 5 insertions(+) (limited to 'Objects/stringobject.c') diff --git a/Objects/stringobject.c b/Objects/stringobject.c index 283e219d34..724121f0b1 100644 --- a/Objects/stringobject.c +++ b/Objects/stringobject.c @@ -433,6 +433,11 @@ string_hash(a) #ifdef CACHE_HASH if (a->ob_shash != -1) return a->ob_shash; +#ifdef INTERN_STRINGS + if (a->ob_sinterned != NULL) + return (a->ob_shash = + ((stringobject *)(a->ob_sinterned))->ob_shash); +#endif #endif len = a->ob_size; p = (unsigned char *) a->ob_sval; -- cgit v1.2.1