1 /*********************** -*- Mode: C -*- ***********************
2 * File : bintree_init.c
3 *---------------------------------------------------------------
4 * Description
5 * ===========
6 * This operations initialise an instance of a binary tree at runtime.
7 *
8 * this - the "tree" instance to initialise
9 *
10 * offset - the offset of the node structure within the clients
11 * structure. This is typically passed using the offsetof() macro.
12 *
13 * compareFn - a comparison function for comparing a "clientnode"
14 * with a "clientkey"
15 *
16 * getkeyFn - a function which will fill out a "key" from a clientnode
17 *
18 * RETURNS
19 * none
20 *---------------------------------------------------------------
21 * Author : Graeme McKerrell
22 * Created On : Wed Jan 28 09:54:37 2004
23 * Status : TESTED
24 *---------------------------------------------------------------
25 * HISTORY
26 * 7-Dec-2004 Graeme McKerrell
27 * Renamed to the "lub_" namespace
28 * 5-May-2004 Graeme McKerrell
29 * updates following review
30 * 9-Feb-2004 Graeme McKerrell
31 * update to remove spurious key_storage parameter
32 * 28-Jan-2004 Graeme McKerrell
33 * Initial version
34 *---------------------------------------------------------------
35 * Copyright (C) 2004 3Com Corporation. All Rights Reserved.
36 **************************************************************** */
37 #include "private.h"
38
39 /*--------------------------------------------------------- */
40 void
lub_bintree_init(lub_bintree_t * this,size_t node_offset,lub_bintree_compare_fn compareFn,lub_bintree_getkey_fn getkeyFn)41 lub_bintree_init(lub_bintree_t * this,
42 size_t node_offset,
43 lub_bintree_compare_fn compareFn,
44 lub_bintree_getkey_fn getkeyFn)
45 {
46 this->root = NULL;
47 this->node_offset = node_offset;
48 this->compareFn = compareFn;
49 this->getkeyFn = getkeyFn;
50 }
51
52 /*--------------------------------------------------------- */
53