Automatic date update in version.in
[deliverable/binutils-gdb.git] / include / splay-tree.h
index 159ea801c1a1a17b8998a374153b3c3568394ffc..da533dec183ffa15ebfe0a87e42635090fdfc522 100644 (file)
@@ -1,5 +1,5 @@
 /* A splay-tree datatype.  
-   Copyright (C) 1998-2015 Free Software Foundation, Inc.
+   Copyright (C) 1998-2019 Free Software Foundation, Inc.
    Contributed by Mark Mitchell (mark@markmitchell.com).
 
    This file is part of GCC.
@@ -43,10 +43,6 @@ extern "C" {
 #include <inttypes.h>
 #endif
 
-#ifndef GTY
-#define GTY(X)
-#endif
-
 /* Use typedefs for the key and data types to facilitate changing
    these types, if necessary.  These types should be sufficiently wide
    that any pointer or scalar can be cast to these types, and then
@@ -62,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.  */
@@ -85,22 +88,22 @@ typedef void *(*splay_tree_allocate_fn) (int, void *);
 typedef void (*splay_tree_deallocate_fn) (void *, void *);
 
 /* The nodes in the splay tree.  */
-struct GTY(()) splay_tree_node_s {
+struct splay_tree_node_s {
   /* The key.  */
-  splay_tree_key GTY ((use_param1)) key;
+  splay_tree_key key;
 
   /* The value.  */
-  splay_tree_value GTY ((use_param2)) value;
+  splay_tree_value value;
 
   /* The left and right children, respectively.  */
-  splay_tree_node GTY ((use_params)) left;
-  splay_tree_node GTY ((use_params)) right;
+  splay_tree_node left;
+  splay_tree_node right;
 };
 
 /* The splay tree itself.  */
-struct GTY(()) splay_tree_s {
+struct splay_tree_s {
   /* The root of the tree.  */
-  splay_tree_node GTY ((use_params)) root;
+  splay_tree_node root;
 
   /* The comparision function.  */
   splay_tree_compare_fn comp;
@@ -118,7 +121,7 @@ struct GTY(()) splay_tree_s {
   splay_tree_deallocate_fn deallocate;
 
   /* Parameter for allocate/free functions.  */
-  void * GTY((skip)) allocate_data;
+  void *allocate_data;
 };
 
 typedef struct splay_tree_s *splay_tree;
@@ -151,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
 }
This page took 0.024357 seconds and 4 git commands to generate.