1
0
mirror of https://github.com/MariaDB/server.git synced 2025-07-30 16:24:05 +03:00

Merge of mysql-5.1-bugteam into mysql-trunk-merge.

This commit is contained in:
Davi Arnaut
2010-06-10 22:30:49 -03:00
61 changed files with 1018 additions and 913 deletions

View File

@ -67,45 +67,61 @@ public:
/**
Struct to handle simple linked lists.
@todo What is the relation between this class and list_node, below?
/Matz
@see list_node, base_list, List
Simple intrusive linked list.
@remark Similar in nature to base_list, but intrusive. It keeps a
a pointer to the first element in the list and a indirect
reference to the last element.
*/
typedef struct st_sql_list {
template <typename T>
class SQL_I_List :public Sql_alloc
{
public:
uint elements;
uchar *first;
uchar **next;
/** The first element in the list. */
T *first;
/** A reference to the next element in the list. */
T **next;
SQL_I_List() { empty(); }
SQL_I_List(const SQL_I_List &tmp)
{
elements= tmp.elements;
first= tmp.first;
next= elements ? tmp.next : &first;
}
st_sql_list() {} /* Remove gcc warning */
inline void empty()
{
elements=0;
first=0;
elements= 0;
first= NULL;
next= &first;
}
inline void link_in_list(uchar *element,uchar **next_ptr)
inline void link_in_list(T *element, T **next_ptr)
{
elements++;
(*next)=element;
(*next)= element;
next= next_ptr;
*next=0;
*next= NULL;
}
inline void save_and_clear(struct st_sql_list *save)
inline void save_and_clear(SQL_I_List<T> *save)
{
*save= *this;
empty();
}
inline void push_front(struct st_sql_list *save)
inline void push_front(SQL_I_List<T> *save)
{
*save->next= first; /* link current list last */
/* link current list last */
*save->next= first;
first= save->first;
elements+= save->elements;
}
inline void push_back(struct st_sql_list *save)
inline void push_back(SQL_I_List<T> *save)
{
if (save->first)
{
@ -114,7 +130,7 @@ typedef struct st_sql_list {
elements+= save->elements;
}
}
} SQL_LIST;
};
/*