~drizzle-trunk/drizzle/development

« back to all changes in this revision

Viewing changes to drizzled/my_tree.cc

Merge Monty

Show diffs side-by-side

added added

removed removed

Lines of Context:
53
53
    (*tree->compare)(custom_arg, key, ELEMENT_KEY(tree,element))
54
54
*/
55
55
 
56
 
#include "mysys/mysys_priv.h"
57
 
#include <mystrings/m_string.h>
58
 
#include <mysys/my_tree.h>
 
56
#include "config.h"
 
57
 
 
58
#include "drizzled/my_tree.h"
 
59
#include "drizzled/internal/my_sys.h"
 
60
#include "drizzled/internal/m_string.h"
 
61
#include "drizzled/memory/root.h"
59
62
 
60
63
#define BLACK           1
61
64
#define RED             0
62
65
#define DEFAULT_ALLOC_SIZE 8192
63
66
#define DEFAULT_ALIGN_SIZE 8192
64
67
 
 
68
#define ELEMENT_KEY(tree,element)\
 
69
(tree->offset_to_key ? (void*)((unsigned char*) element+tree->offset_to_key) :\
 
70
                        *((void**) (element+1)))
 
71
#define ELEMENT_CHILD(element, offs) (*(TREE_ELEMENT**)((char*)element + offs))
 
72
 
65
73
static void delete_tree_element(TREE *,TREE_ELEMENT *);
66
74
static int tree_walk_left_root_right(TREE *,TREE_ELEMENT *,
67
75
                                     tree_walk_action,void *);
511
519
    if ((error=tree_walk_left_root_right(tree,element->left,action,
512
520
                                          argument)) == 0 &&
513
521
        (error=(*action)(ELEMENT_KEY(tree,element),
514
 
                          (element_count) element->count,
 
522
                          element->count,
515
523
                          argument)) == 0)
516
524
      error=tree_walk_left_root_right(tree,element->right,action,argument);
517
525
    return error;
528
536
    if ((error=tree_walk_right_root_left(tree,element->right,action,
529
537
                                          argument)) == 0 &&
530
538
        (error=(*action)(ELEMENT_KEY(tree,element),
531
 
                          (element_count) element->count,
 
539
                          element->count,
532
540
                          argument)) == 0)
533
541
     error=tree_walk_right_root_left(tree,element->left,action,argument);
534
542
    return error;