diff options
author | Mats Kindahl <mats@sun.com> | 2010-03-31 16:05:33 +0200 |
---|---|---|
committer | Mats Kindahl <mats@sun.com> | 2010-03-31 16:05:33 +0200 |
commit | 23d8586dbfdfdf02fa2f801b9dad91db53025a64 (patch) | |
tree | 19f32879e77ada23d733f35173a25f410d655ebe /sql/sql_list.h | |
parent | d7dd2fc92f042596c2e72a96934bb207270e7419 (diff) | |
download | mariadb-git-23d8586dbfdfdf02fa2f801b9dad91db53025a64.tar.gz |
WL#5030: Split and remove mysql_priv.h
This patch:
- Moves all definitions from the mysql_priv.h file into
header files for the component where the variable is
defined
- Creates header files if the component lacks one
- Eliminates all include directives from mysql_priv.h
- Eliminates all circular include cycles
- Rename time.cc to sql_time.cc
- Rename mysql_priv.h to sql_priv.h
Diffstat (limited to 'sql/sql_list.h')
-rw-r--r-- | sql/sql_list.h | 59 |
1 files changed, 59 insertions, 0 deletions
diff --git a/sql/sql_list.h b/sql/sql_list.h index fdc80b116a7..60d9697a606 100644 --- a/sql/sql_list.h +++ b/sql/sql_list.h @@ -26,6 +26,11 @@ void *sql_alloc(size_t); +#include "my_sys.h" /* alloc_root, TRASH, MY_WME, + MY_FAE, MY_ALLOW_ZERO_PTR */ +#include "m_string.h" /* bfill */ +#include "thr_malloc.h" /* sql_alloc */ + /* mysql standard class memory allocator */ class Sql_alloc @@ -61,6 +66,57 @@ 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 + +*/ +typedef struct st_sql_list { + uint elements; + uchar *first; + uchar **next; + + st_sql_list() {} /* Remove gcc warning */ + inline void empty() + { + elements=0; + first=0; + next= &first; + } + inline void link_in_list(uchar *element,uchar **next_ptr) + { + elements++; + (*next)=element; + next= next_ptr; + *next=0; + } + inline void save_and_clear(struct st_sql_list *save) + { + *save= *this; + empty(); + } + inline void push_front(struct st_sql_list *save) + { + *save->next= first; /* link current list last */ + first= save->first; + elements+= save->elements; + } + inline void push_back(struct st_sql_list *save) + { + if (save->first) + { + *next= save->first; + next= save->next; + elements+= save->elements; + } + } +} SQL_LIST; + + /* Basic single linked list Used for item and item_buffs. @@ -637,4 +693,7 @@ list_copy_and_replace_each_value(List<T> &list, MEM_ROOT *mem_root) it.replace(el->clone(mem_root)); } +void free_list(I_List <i_string_pair> *list); +void free_list(I_List <i_string> *list); + #endif // INCLUDES_MYSQL_SQL_LIST_H |