aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authoredlinger <edlinger@138bc75d-0d04-0410-961f-82ee72b054a4>2018-05-28 18:21:23 +0000
committerRichard Earnshaw <Richard.Earnshaw@arm.com>2018-05-31 10:17:13 +0100
commit22467434fdc240e7c166f77f371909a8a07fc358 (patch)
treef80a7a1500f03cb5fdec584f1fcaaf17d0fe57b8 /libiberty
parentImprove boostrap-ubsan config (PR bootstrap/64914). (diff)
downloadbinutils-gdb-22467434fdc240e7c166f77f371909a8a07fc358.tar.gz
binutils-gdb-22467434fdc240e7c166f77f371909a8a07fc358.tar.bz2
binutils-gdb-22467434fdc240e7c166f77f371909a8a07fc358.zip
include: 2018-05-28 Bernd Edlinger <bernd.edlinger@hotmail.de>
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
Diffstat (limited to 'libiberty')
-rw-r--r--libiberty/ChangeLog5
-rw-r--r--libiberty/splay-tree.c19
2 files changed, 24 insertions, 0 deletions
diff --git a/libiberty/ChangeLog b/libiberty/ChangeLog
index b249226155c..19c62699c07 100644
--- a/libiberty/ChangeLog
+++ b/libiberty/ChangeLog
@@ -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
diff --git a/libiberty/splay-tree.c b/libiberty/splay-tree.c
index 23d22a89d8e..d3be4aa90b5 100644
--- a/libiberty/splay-tree.c
+++ b/libiberty/splay-tree.c
@@ -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);
+}