mariadb/include/my_tree.h
unknown 1040f1ac8e Fixes for FULLTEXT and TIME type
Docs/manual.texi:
  Update of Linux notes and mysql_install_db
include/my_tree.h:
  new tree function
myisam/ft_parser.c:
  Fix free() bug
myisam/ft_search.c:
  Fix free() bug
myisam/ft_update.c:
  Fix free() bug
scripts/safe_mysqld.sh:
  Check if we run as root
sql-bench/Results-linux/ATIS-mysql-Linux_2.2.13_SMP_alpha:
  ***MISSING WEAVE***
sql-bench/Results-linux/ATIS-mysql_fast-Linux_2.2.13_SMP_alpha:
  ***MISSING WEAVE***
sql-bench/Results-linux/RUN-mysql-Linux_2.2.13_SMP_alpha:
  ***MISSING WEAVE***
sql-bench/Results-linux/RUN-mysql_fast-Linux_2.2.13_SMP_alpha:
  ***MISSING WEAVE***
sql-bench/Results-linux/alter-table-mysql-Linux_2.2.13_SMP_alpha:
  ***MISSING WEAVE***
sql-bench/Results-linux/alter-table-mysql_fast-Linux_2.2.13_SMP_alpha:
  ***MISSING WEAVE***
sql-bench/Results-linux/big-tables-mysql-Linux_2.2.13_SMP_alpha:
  ***MISSING WEAVE***
sql-bench/Results-linux/big-tables-mysql_fast-Linux_2.2.13_SMP_alpha:
  ***MISSING WEAVE***
sql-bench/Results-linux/connect-mysql-Linux_2.2.13_SMP_alpha:
  ***MISSING WEAVE***
sql-bench/Results-linux/connect-mysql_fast-Linux_2.2.13_SMP_alpha:
  ***MISSING WEAVE***
sql-bench/Results-linux/create-mysql-Linux_2.2.13_SMP_alpha:
  ***MISSING WEAVE***
sql-bench/Results-linux/create-mysql_fast-Linux_2.2.13_SMP_alpha:
  ***MISSING WEAVE***
sql-bench/Results-linux/insert-mysql-Linux_2.2.13_SMP_alpha:
  ***MISSING WEAVE***
sql-bench/Results-linux/insert-mysql_fast-Linux_2.2.13_SMP_alpha:
  ***MISSING WEAVE***
sql-bench/Results-linux/select-mysql-Linux_2.2.13_SMP_alpha:
  ***MISSING WEAVE***
sql-bench/Results-linux/select-mysql_fast-Linux_2.2.13_SMP_alpha:
  ***MISSING WEAVE***
sql-bench/Results-linux/wisconsin-mysql-Linux_2.2.13_SMP_alpha:
  ***MISSING WEAVE***
sql-bench/Results-linux/wisconsin-mysql_fast-Linux_2.2.13_SMP_alpha:
  ***MISSING WEAVE***
sql-bench/server-cfg.sh:
  Added use of OPTIMIZE TABLE
sql-bench/test-ATIS.sh:
  Added use of OPTIMIZE TABLE
sql-bench/test-insert.sh:
  Added use of OPTIMIZE TABLE
sql-bench/test-select.sh:
  Added use of OPTIMIZE TABLE
sql-bench/test-wisconsin.sh:
  Added use of OPTIMIZE TABLE
sql/field.cc:
  Fix TIME type
sql/item_func.h:
  Fixed Free bug
2000-09-13 01:08:34 +03:00

76 lines
2.4 KiB
C

/* Copyright (C) 2000 MySQL AB & MySQL Finland AB & TCX DataKonsult AB
This library is free software; you can redistribute it and/or
modify it under the terms of the GNU Library General Public
License as published by the Free Software Foundation; either
version 2 of the License, or (at your option) any later version.
This library is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
Library General Public License for more details.
You should have received a copy of the GNU Library General Public
License along with this library; if not, write to the Free
Software Foundation, Inc., 59 Temple Place - Suite 330, Boston,
MA 02111-1307, USA */
#ifndef _tree_h
#define _tree_h
#ifdef __cplusplus
extern "C" {
#endif
#define MAX_TREE_HIGHT 40 /* = max 1048576 leafs in tree */
#define ELEMENT_KEY(tree,element)\
(tree->offset_to_key ? (void*)((byte*) element+tree->offset_to_key) :\
*((void**) (element+1)))
#define tree_set_pointer(element,ptr) *((byte **) (element+1))=((byte*) (ptr))
typedef enum { left_root_right, right_root_left } TREE_WALK;
typedef uint32 element_count;
typedef int (*tree_walk_action)(void *,element_count,void *);
#ifdef MSDOS
typedef struct st_tree_element {
struct st_tree_element *left,*right;
unsigned long count;
uchar colour; /* black is marked as 1 */
} TREE_ELEMENT;
#else
typedef struct st_tree_element {
struct st_tree_element *left,*right;
uint32 count:31,
colour:1; /* black is marked as 1 */
} TREE_ELEMENT;
#endif /* MSDOS */
typedef struct st_tree {
TREE_ELEMENT *root,null_element;
TREE_ELEMENT **parents[MAX_TREE_HIGHT];
uint offset_to_key,elements_in_tree,size_of_element;
qsort_cmp compare;
MEM_ROOT mem_root;
my_bool with_delete;
void (*free)(void *);
} TREE;
/* Functions on hole tree */
void init_tree(TREE *tree,uint default_alloc_size, int element_size,
qsort_cmp compare, my_bool with_delete,
void (*free_element)(void*));
void delete_tree(TREE*);
#define is_tree_inited(tree) ((tree)->root != 0)
/* Functions on leafs */
TREE_ELEMENT *tree_insert(TREE *tree,void *key,uint key_size);
void *tree_search(TREE *tree,void *key);
int tree_walk(TREE *tree,tree_walk_action action,
void *argument, TREE_WALK visit);
int tree_delete(TREE *tree,void *key);
#ifdef __cplusplus
}
#endif
#endif