summaryrefslogtreecommitdiff
path: root/mysys
diff options
context:
space:
mode:
authorMarko Mäkelä <marko.makela@mariadb.com>2018-11-06 16:24:16 +0200
committerMarko Mäkelä <marko.makela@mariadb.com>2018-11-06 16:24:16 +0200
commit074c68409921032f8a64416cc4d5ebc35d95dca9 (patch)
tree615c99d326fd2ce8c0e3b533b40f0e4e3475bbc1 /mysys
parent563efeceece09154f71da6303244b1df36875428 (diff)
parentdf563e0c037f9b2cdb22e145575f92a121b4b529 (diff)
downloadmariadb-git-074c68409921032f8a64416cc4d5ebc35d95dca9.tar.gz
Merge 10.3 into 10.4
Diffstat (limited to 'mysys')
-rw-r--r--mysys/CMakeLists.txt1
-rw-r--r--mysys/mf_iocache.c16
-rw-r--r--mysys/mf_iocache2.c4
-rw-r--r--mysys/ptr_cmp.c7
4 files changed, 24 insertions, 4 deletions
diff --git a/mysys/CMakeLists.txt b/mysys/CMakeLists.txt
index 93fca192b3a..97890cc9de7 100644
--- a/mysys/CMakeLists.txt
+++ b/mysys/CMakeLists.txt
@@ -1,4 +1,5 @@
# Copyright (c) 2006, 2014, Oracle and/or its affiliates
+# Copyright (c) 2009, 2018, MariaDB Corporation
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
diff --git a/mysys/mf_iocache.c b/mysys/mf_iocache.c
index 88678949e94..0f93b2303b3 100644
--- a/mysys/mf_iocache.c
+++ b/mysys/mf_iocache.c
@@ -354,6 +354,15 @@ int init_slave_io_cache(IO_CACHE *master, IO_CACHE *slave)
void end_slave_io_cache(IO_CACHE *cache)
{
+ /* Remove the cache from the next_file_user circular linked list. */
+ if (cache->next_file_user != cache)
+ {
+ IO_CACHE *p= cache->next_file_user;
+ while (p->next_file_user != cache)
+ p= p->next_file_user;
+ p->next_file_user= cache->next_file_user;
+
+ }
my_free(cache->buffer);
}
@@ -635,7 +644,7 @@ int _my_b_write(IO_CACHE *info, const uchar *Buffer, size_t Count)
int _my_b_cache_read(IO_CACHE *info, uchar *Buffer, size_t Count)
{
- size_t length, diff_length, left_length= 0, max_length;
+ size_t length= 0, diff_length, left_length= 0, max_length;
my_off_t pos_in_file;
DBUG_ENTER("_my_b_cache_read");
@@ -751,7 +760,10 @@ int _my_b_cache_read(IO_CACHE *info, uchar *Buffer, size_t Count)
else
{
info->error= 0;
- DBUG_RETURN(0); /* EOF */
+ if (length == 0) /* nothing was read */
+ DBUG_RETURN(0); /* EOF */
+
+ length= 0; /* non-zero size read was done */
}
}
else
diff --git a/mysys/mf_iocache2.c b/mysys/mf_iocache2.c
index ef163ee24d3..2bb36129c91 100644
--- a/mysys/mf_iocache2.c
+++ b/mysys/mf_iocache2.c
@@ -1,4 +1,5 @@
-/* Copyright (c) 2000, 2014, Oracle and/or its affiliates. All rights reserved.
+/* Copyright (c) 2000, 2018, Oracle and/or its affiliates.
+ Copyright (c) 2009, 2018, MariaDB Corporation
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
@@ -486,4 +487,3 @@ process_flags:
err:
return (size_t) -1;
}
-
diff --git a/mysys/ptr_cmp.c b/mysys/ptr_cmp.c
index 1880e60a811..99c7df69b1d 100644
--- a/mysys/ptr_cmp.c
+++ b/mysys/ptr_cmp.c
@@ -61,9 +61,16 @@ static int ptr_compare_0(size_t *compare_length, uchar **a, uchar **b);
static int ptr_compare_1(size_t *compare_length, uchar **a, uchar **b);
static int ptr_compare_2(size_t *compare_length, uchar **a, uchar **b);
static int ptr_compare_3(size_t *compare_length, uchar **a, uchar **b);
+static int degenerate_compare_func(size_t *compare_length, uchar **a, uchar **b)
+{
+ DBUG_ASSERT(*compare_length == 0);
+ return 0;
+}
qsort2_cmp get_ptr_compare (size_t size)
{
+ if (size == 0)
+ return (qsort2_cmp) degenerate_compare_func;
if (size < 4)
return (qsort2_cmp) ptr_compare;
switch (size & 3) {