summaryrefslogtreecommitdiff
path: root/mysys/mf_iocache.c
diff options
context:
space:
mode:
authorunknown <Kristofer.Pettersson@naruto.>2007-01-11 09:41:44 +0100
committerunknown <Kristofer.Pettersson@naruto.>2007-01-11 09:41:44 +0100
commit029d6cf92d4dd678eddca3abca26e46ea5af2f47 (patch)
tree380812bdfe01b8a012701cf3d9354f31114e6944 /mysys/mf_iocache.c
parenta63a66cb46d16088fd9c634c2b0ebca0471e78ad (diff)
parent2cbccbfb0cdcc880ab57bc24a17df473d5b1bdcd (diff)
downloadmariadb-git-029d6cf92d4dd678eddca3abca26e46ea5af2f47.tar.gz
Merge naruto.:C:/cpp/bug24751/my41-bug24751
into naruto.:C:/cpp/bug24751/my50-bug24751 mysys/mf_iocache.c: Auto merged
Diffstat (limited to 'mysys/mf_iocache.c')
-rw-r--r--mysys/mf_iocache.c7
1 files changed, 4 insertions, 3 deletions
diff --git a/mysys/mf_iocache.c b/mysys/mf_iocache.c
index e0962999015..49d050689ac 100644
--- a/mysys/mf_iocache.c
+++ b/mysys/mf_iocache.c
@@ -201,11 +201,11 @@ int init_io_cache(IO_CACHE *info, File file, uint cachesize,
if (type != READ_NET && type != WRITE_NET)
{
/* Retry allocating memory in smaller blocks until we get one */
+ cachesize=(uint) ((ulong) (cachesize + min_cache-1) &
+ (ulong) ~(min_cache-1));
for (;;)
{
uint buffer_block;
- cachesize=(uint) ((ulong) (cachesize + min_cache-1) &
- (ulong) ~(min_cache-1));
if (cachesize < min_cache)
cachesize = min_cache;
buffer_block = cachesize;
@@ -224,7 +224,8 @@ int init_io_cache(IO_CACHE *info, File file, uint cachesize,
}
if (cachesize == min_cache)
DBUG_RETURN(2); /* Can't alloc cache */
- cachesize= (uint) ((long) cachesize*3/4); /* Try with less memory */
+ /* Try with less memory */
+ cachesize= (uint) ((ulong) cachesize*3/4 & (ulong)~(min_cache-1));
}
}