include: 2018-05-28 Bernd Edlinger <bernd.edlinger@hotmail.de>
authoredlinger <edlinger@138bc75d-0d04-0410-961f-82ee72b054a4>
Mon, 28 May 2018 18:21:23 +0000 (18:21 +0000)
committerRichard Earnshaw <Richard.Earnshaw@arm.com>
Thu, 31 May 2018 09:17:13 +0000 (10:17 +0100)
include:
        * splay-tree.h (splay_tree_compare_strings,
        splay_tree_delete_pointers): Declare new utility functions.

libiberty:
2018-05-28  Bernd Edlinger  <bernd.edlinger@hotmail.de>

        * splay-tree.c (splay_tree_compare_strings,
        splay_tree_delete_pointers): New utility functions.

git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@260850 138bc75d-0d04-0410-961f-82ee72b054a4

include/ChangeLog
include/splay-tree.h
libiberty/ChangeLog
libiberty/splay-tree.c

index 8b303bd47d4770d7d719f215aa4a81df4fbbd76a..5693a3e28e435e9695b344549b9cddbb28269fe9 100644 (file)
@@ -1,3 +1,8 @@
+2018-05-28  Bernd Edlinger  <bernd.edlinger@hotmail.de>
+
+       * splay-tree.h (splay_tree_compare_strings,
+       splay_tree_delete_pointers): Declare new utility functions.
+
 2018-05-21  Peter Bergner  <bergner@vnet.ibm.com.com>
 
        * opcode/ppc.h (PPC_OPERAND_FAKE): Delete macro.
index b63612cc0a454d40d57efff90842d4c098661351..fc94fb786fb63c1e8690e9940f9381314c93a98b 100644 (file)
@@ -147,7 +147,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
 }
index b249226155c99a9d9031029b1548cc06114ba601..19c62699c07aaa14cfb383269d3ba6acd82cf2c2 100644 (file)
@@ -1,3 +1,8 @@
+2018-05-28  Bernd Edlinger  <bernd.edlinger@hotmail.de>
+
+       * splay-tree.c (splay_tree_compare_strings,
+       splay_tree_delete_pointers): New utility functions.
+
 2018-05-10  Martin Liska  <mliska@suse.cz>
 
        PR bootstrap/64914
index 23d22a89d8eab06d52b0d9b06914a008bb8fff7e..d3be4aa90b54dc5f4bda4fdb44835e4b44dcd253 100644 (file)
@@ -31,6 +31,9 @@ Boston, MA 02110-1301, USA.  */
 #ifdef HAVE_STDLIB_H
 #include <stdlib.h>
 #endif
+#ifdef HAVE_STRING_H
+#include <string.h>
+#endif
 
 #include <stdio.h>
 
@@ -590,3 +593,19 @@ splay_tree_compare_pointers (splay_tree_key k1, splay_tree_key k2)
   else 
     return 0;
 }
+
+/* Splay-tree comparison function, treating the keys as strings.  */
+
+int
+splay_tree_compare_strings (splay_tree_key k1, splay_tree_key k2)
+{
+  return strcmp ((char *) k1, (char *) k2);
+}
+
+/* Splay-tree delete function, simply using free.  */
+
+void
+splay_tree_delete_pointers (splay_tree_value value)
+{
+  free ((void *) value);
+}