From e41123b89fbf0bb0590c1736f7ad2f9bbb2c47c4 Mon Sep 17 00:00:00 2001 From: unknown Date: Mon, 18 Nov 2002 14:59:45 +0200 Subject: Small change to make key cache code cleaer --- mysys/mf_keycache.c | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/mysys/mf_keycache.c b/mysys/mf_keycache.c index 5b8ec96b4d1..d5b0a0a056a 100644 --- a/mysys/mf_keycache.c +++ b/mysys/mf_keycache.c @@ -548,13 +548,14 @@ int flush_key_blocks(File file, enum flush_type type) count++; } /* Only allocate a new buffer if its bigger than the one we have */ - if (count <= FLUSH_CACHE || - !(cache=(SEC_LINK**) my_malloc(sizeof(SEC_LINK*)*count,MYF(0)))) + if (count > FLUSH_CACHE) { - cache=cache_buff; /* Fall back to safe buffer */ - count=FLUSH_CACHE; + if (!(cache=(SEC_LINK**) my_malloc(sizeof(SEC_LINK*)*count,MYF(0)))) + { + cache=cache_buff; /* Fall back to safe buffer */ + count=FLUSH_CACHE; + } } - end=cache+count; } /* Go through the keys and write them to buffer to be flushed */ -- cgit v1.2.1