diff options
Diffstat (limited to 'mysys/mf_keycaches.c')
-rw-r--r-- | mysys/mf_keycaches.c | 14 |
1 files changed, 9 insertions, 5 deletions
diff --git a/mysys/mf_keycaches.c b/mysys/mf_keycaches.c index 51ad54159e5..3f40f4f4010 100644 --- a/mysys/mf_keycaches.c +++ b/mysys/mf_keycaches.c @@ -147,7 +147,8 @@ static void safe_hash_free(SAFE_HASH *hash) Return the value stored for a key or default value if no key */ -static byte *safe_hash_search(SAFE_HASH *hash, const byte *key, uint length) +static byte *safe_hash_search(SAFE_HASH *hash, const byte *key, uint length, + byte *def) { byte *result; DBUG_ENTER("safe_hash_search"); @@ -155,7 +156,7 @@ static byte *safe_hash_search(SAFE_HASH *hash, const byte *key, uint length) result= hash_search(&hash->hash, key, length); rw_unlock(&hash->mutex); if (!result) - result= hash->default_value; + result= def; else result= ((SAFE_HASH_ENTRY*) result)->data; DBUG_PRINT("exit",("data: 0x%lx", (long) result)); @@ -315,6 +316,7 @@ void multi_keycache_free(void) multi_key_cache_search() key key to find (usually table path) uint length Length of key. + def Default value if no key cache NOTES This function is coded in such a way that we will return the @@ -325,11 +327,13 @@ void multi_keycache_free(void) key cache to use */ -KEY_CACHE *multi_key_cache_search(byte *key, uint length) +KEY_CACHE *multi_key_cache_search(byte *key, uint length, + KEY_CACHE *def) { if (!key_cache_hash.hash.records) - return dflt_key_cache; - return (KEY_CACHE*) safe_hash_search(&key_cache_hash, key, length); + return def; + return (KEY_CACHE*) safe_hash_search(&key_cache_hash, key, length, + (void*) def); } |