1
0
mirror of https://github.com/MariaDB/server.git synced 2025-07-30 16:24:05 +03:00
checkpoint.
does not compile.
This commit is contained in:
Sergei Golubchik
2010-11-25 18:17:28 +01:00
2732 changed files with 867504 additions and 20901 deletions

View File

@ -54,7 +54,7 @@ public:
static void operator delete[](void *ptr, MEM_ROOT *mem_root)
{ /* never called */ }
static void operator delete[](void *ptr, size_t size) { TRASH(ptr, size); }
#ifdef HAVE_purify
#ifdef HAVE_valgrind
bool dummy;
inline Sql_alloc() :dummy(0) {}
inline ~Sql_alloc() {}
@ -520,6 +520,43 @@ public:
};
/*
Exchange sort algorithm for List<T>.
*/
template <class T>
inline void exchange_sort(List<T> *list_to_sort,
int (*sort_func)(T *a, T *b, void *arg), void *arg)
{
bool swap;
List_iterator<T> it(*list_to_sort);
do
{
T *item1= it++;
T **ref1= it.ref();
T *item2;
swap= FALSE;
while ((item2= it++))
{
T **ref2= it.ref();
if (sort_func(item1, item2, arg) < 0)
{
T *item= *ref1;
*ref1= *ref2;
*ref2= item;
swap= TRUE;
}
else
{
item1= item2;
ref1= ref2;
}
}
it.rewind();
} while (swap);
}
/*
A simple intrusive list which automaticly removes element from list
on delete (for THD element)