summaryrefslogtreecommitdiff
path: root/sql/examples
diff options
context:
space:
mode:
authorunknown <petr@mysql.com>2005-11-08 01:27:15 +0300
committerunknown <petr@mysql.com>2005-11-08 01:27:15 +0300
commitce648a30dbc039849b9e1de23ddc7e4e76c29a5f (patch)
treed4450c87a861da181cd11a22c60bbfa29fed6e7f /sql/examples
parent50f48187f2f135b458aee47c561b3afe7df5aa07 (diff)
parent01cad6395e852e431b1a66ec9f7034e0aee98b71 (diff)
downloadmariadb-git-ce648a30dbc039849b9e1de23ddc7e4e76c29a5f.tar.gz
Merge mysql.com:/home/cps/mysql/trees/mysql-4.1
into mysql.com:/home/cps/mysql/trees/mysql-5.0-virgin sql/examples/ha_tina.cc: Auto merged support-files/mysql.spec.sh: SCCS merged
Diffstat (limited to 'sql/examples')
-rw-r--r--sql/examples/ha_tina.cc22
1 files changed, 11 insertions, 11 deletions
diff --git a/sql/examples/ha_tina.cc b/sql/examples/ha_tina.cc
index 541e91f4b46..e00657c66ba 100644
--- a/sql/examples/ha_tina.cc
+++ b/sql/examples/ha_tina.cc
@@ -82,12 +82,16 @@ handlerton tina_hton= {
** TINA tables
*****************************************************************************/
-/*
- Used for sorting chains.
+/*
+ Used for sorting chains with qsort().
*/
int sort_set (tina_set *a, tina_set *b)
{
- return ( a->begin > b->begin ? 1 : ( a->begin < b->begin ? -1 : 0 ) );
+ /*
+ We assume that intervals do not intersect. So, it is enought to compare
+ any two points. Here we take start of intervals for comparison.
+ */
+ return ( a->begin > b->begin ? -1 : ( a->begin < b->begin ? 1 : 0 ) );
}
static byte* tina_get_key(TINA_SHARE *share,uint *length,
@@ -186,7 +190,8 @@ static TINA_SHARE *get_share(const char *table_name, TABLE *table)
thr_lock_init(&share->lock);
pthread_mutex_init(&share->mutex,MY_MUTEX_INIT_FAST);
- if ((share->data_file= my_open(data_file_name, O_RDWR, MYF(0))) == -1)
+ if ((share->data_file= my_open(data_file_name, O_RDWR|O_APPEND,
+ MYF(0))) == -1)
goto error2;
/* We only use share->data_file for writing, so we scan to the end to append */
@@ -797,13 +802,8 @@ int ha_tina::rnd_end()
qsort(chain, (size_t)(chain_ptr - chain), sizeof(tina_set), (qsort_cmp)sort_set);
for (ptr= chain; ptr < chain_ptr; ptr++)
{
- /* We peek a head to see if this is the last chain */
- if (ptr+1 == chain_ptr)
- memmove(share->mapped_file + ptr->begin, share->mapped_file + ptr->end,
- length - (size_t)ptr->end);
- else
- memmove((caddr_t)share->mapped_file + ptr->begin, (caddr_t)share->mapped_file + ptr->end,
- (size_t)((ptr++)->begin - ptr->end));
+ memmove(share->mapped_file + ptr->begin, share->mapped_file + ptr->end,
+ length - (size_t)ptr->end);
length= length - (size_t)(ptr->end - ptr->begin);
}