2 rbl.c -- red-black tree + linked list convenience
3 Copyright (C) 2000 Ivo Timmermans <itimmermans@bigfoot.com>,
4 2000 Guus Sliepen <guus@sliepen.warande.net>
6 This program is free software; you can redistribute it and/or modify
7 it under the terms of the GNU General Public License as published by
8 the Free Software Foundation; either version 2 of the License, or
9 (at your option) any later version.
11 This program is distributed in the hope that it will be useful,
12 but WITHOUT ANY WARRANTY; without even the implied warranty of
13 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 GNU General Public License for more details.
16 You should have received a copy of the GNU General Public License
17 along with this program; if not, write to the Free Software
18 Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
20 $Id: rbl.c,v 1.1.2.1 2000/11/16 09:18:38 guus Exp $
23 rbl_t *new_rbl(rbltree_t *tree)
27 rbl = xmalloc(sizeof(*rbl));
31 memset(rbl, 0, sizeof(*rbl));
38 void free_rbl(rbl_t *rbl)
43 rbl_t rbl_search_closest(rbltree_t *tree, void *data)
48 for(next = rbltree->head; next; next = rbl)
50 result = rbltree->compare(rbl->data, data)
62 rbl_t rbl_search(rbltree_t *tree, void *data)
67 for(next = rbltree->head; next; next = rbl)
69 result = rbltree->compare(rbl->data, data)
81 rbl_t rbl_insert(rbltree_t *tree, void *data)