summaryrefslogtreecommitdiff
path: root/mysys/mf_keycache.c
diff options
context:
space:
mode:
authorunknown <monty@mashka.mysql.fi>2002-11-18 14:59:45 +0200
committerunknown <monty@mashka.mysql.fi>2002-11-18 14:59:45 +0200
commite41123b89fbf0bb0590c1736f7ad2f9bbb2c47c4 (patch)
tree7f348074683931ade828cf469b5df502087402bf /mysys/mf_keycache.c
parent3a58dc5a4ecb0cf0f3ed29c9250ba7adec784fae (diff)
downloadmariadb-git-e41123b89fbf0bb0590c1736f7ad2f9bbb2c47c4.tar.gz
Small change to make key cache code cleaer
Diffstat (limited to 'mysys/mf_keycache.c')
-rw-r--r--mysys/mf_keycache.c11
1 files 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 */