1 /* ternary.h - Ternary Search Trees
2 Copyright 2001 Free Software Foundation, Inc.
4 Contributed by Daniel Berlin (dan@cgsoftware.com)
7 This program is free software; you can redistribute it and/or modify it
8 under the terms of the GNU General Public License as published by the
9 Free Software Foundation; either version 2, or (at your option) any
12 This program is distributed in the hope that it will be useful,
13 but WITHOUT ANY WARRANTY; without even the implied warranty of
14 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15 GNU General Public License for more details.
17 You should have received a copy of the GNU General Public License
18 along with this program; if not, write to the Free Software
19 Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307,
23 /* Ternary search trees */
25 typedef struct ternary_node_def
*ternary_tree
;
27 typedef struct ternary_node_def
36 /* Insert string S into tree P, associating it with DATA.
37 Return the data in the tree associated with the string if it's
38 already there, and replace is 0.
39 Otherwise, replaces if it it exists, inserts if it doesn't, and
40 returns the data you passed in. */
41 PTR ternary_insert
PARAMS ((ternary_tree
*p
, const char *s
,
42 PTR data
, int replace
));
44 /* Delete the ternary search tree rooted at P.
45 Does NOT delete the data you associated with the strings. */
46 void ternary_cleanup
PARAMS ((ternary_tree p
));
48 /* Search the ternary tree for string S, returning the data associated
50 PTR ternary_search
PARAMS ((const ternary_node
*p
, const char *s
));
This page took 0.02976 seconds and 4 git commands to generate.