X-Git-Url: http://git.efficios.com/?a=blobdiff_plain;f=include%2Fsplay-tree.h;h=7ed69e6c9f534f336f015b7d528e6c06603d59ed;hb=cee00f171520eb85867230d4cbed34480c64e71e;hp=0eef3fa52421ad2932f8d3afd478599b7217c9bb;hpb=6f2750feaf2827ef8a1a0a5b2f90c1e9a6cabbd1;p=deliverable%2Fbinutils-gdb.git diff --git a/include/splay-tree.h b/include/splay-tree.h index 0eef3fa524..7ed69e6c9f 100644 --- a/include/splay-tree.h +++ b/include/splay-tree.h @@ -1,5 +1,5 @@ /* A splay-tree datatype. - Copyright (C) 1998-2016 Free Software Foundation, Inc. + Copyright (C) 1998-2020 Free Software Foundation, Inc. Contributed by Mark Mitchell (mark@markmitchell.com). This file is part of GCC. @@ -58,11 +58,18 @@ typedef struct splay_tree_node_s *splay_tree_node; typedef int (*splay_tree_compare_fn) (splay_tree_key, splay_tree_key); /* The type of a function used to deallocate any resources associated - with the key. */ + with the key. If you provide this function, the splay tree + will take the ownership of the memory of the splay_tree_key arg + of splay_tree_insert. This function is called to release the keys + present in the tree when calling splay_tree_delete or splay_tree_remove. + If splay_tree_insert is called with a key equal to a key already + present in the tree, the old key and old value will be released. */ typedef void (*splay_tree_delete_key_fn) (splay_tree_key); /* The type of a function used to deallocate any resources associated - with the value. */ + with the value. If you provide this function, the memory of the + splay_tree_value arg of splay_tree_insert is managed similarly to + the splay_tree_key memory: see splay_tree_delete_key_fn. */ typedef void (*splay_tree_delete_value_fn) (splay_tree_value); /* The type of a function used to iterate over the tree. */ @@ -147,7 +154,9 @@ extern splay_tree_node splay_tree_max (splay_tree); extern splay_tree_node splay_tree_min (splay_tree); extern int splay_tree_foreach (splay_tree, splay_tree_foreach_fn, void*); extern int splay_tree_compare_ints (splay_tree_key, splay_tree_key); -extern int splay_tree_compare_pointers (splay_tree_key, splay_tree_key); +extern int splay_tree_compare_pointers (splay_tree_key, splay_tree_key); +extern int splay_tree_compare_strings (splay_tree_key, splay_tree_key); +extern void splay_tree_delete_pointers (splay_tree_value); #ifdef __cplusplus }