From ae7f727035108e8c78bfa4d2d506041169d0db1b Mon Sep 17 00:00:00 2001 From: Mark Mitchell Date: Fri, 2 Apr 1999 15:18:06 +0000 Subject: [PATCH] splay-tree.h (splay_tree_compare_pointers): Declare. 1999-04-02 Mark Mitchell * splay-tree.h (splay_tree_compare_pointers): Declare. 1999-04-02 Mark Mitchell * splay-tree.h (splay_tree_compare_pointers): Define. From-SVN: r26132 --- include/ChangeLog | 4 ++++ include/splay-tree.h | 2 ++ libiberty/ChangeLog | 4 ++++ libiberty/splay-tree.c | 15 +++++++++++++++ 4 files changed, 25 insertions(+) diff --git a/include/ChangeLog b/include/ChangeLog index 8c04202b2b9..5f53829d34a 100644 --- a/include/ChangeLog +++ b/include/ChangeLog @@ -1,3 +1,7 @@ +1999-04-02 Mark Mitchell + + * splay-tree.h (splay_tree_compare_pointers): Declare. + 1999-03-30 Mark Mitchell * splay-tree.h (splay_tree_compare_ints): Declare. diff --git a/include/splay-tree.h b/include/splay-tree.h index 509054b3893..e828fe7e907 100644 --- a/include/splay-tree.h +++ b/include/splay-tree.h @@ -106,6 +106,8 @@ extern int splay_tree_foreach PARAMS((splay_tree, void*)); extern int splay_tree_compare_ints PARAMS((splay_tree_key, splay_tree_key)); +extern int splay_tree_compare_pointers PARAMS((splay_tree_key, + splay_tree_key)); #ifdef __cplusplus } diff --git a/libiberty/ChangeLog b/libiberty/ChangeLog index 8ce7bf495e4..74b082a9358 100644 --- a/libiberty/ChangeLog +++ b/libiberty/ChangeLog @@ -1,3 +1,7 @@ +1999-04-02 Mark Mitchell + + * splay-tree.h (splay_tree_compare_pointers): Define. + 1999-03-30 Mark Mitchell * splay-tree.c (splay_tree_compare_ints): Define. diff --git a/libiberty/splay-tree.c b/libiberty/splay-tree.c index 24d035d2d60..b6bb5a6a8f0 100644 --- a/libiberty/splay-tree.c +++ b/libiberty/splay-tree.c @@ -351,3 +351,18 @@ splay_tree_compare_ints (k1, k2) else return 0; } + +/* Splay-tree comparison function, treating the keys as pointers. */ + +int +splay_tree_compare_pointers (k1, k2) + splay_tree_key k1; + splay_tree_key k2; +{ + if ((char*) k1 < (char*) k2) + return -1; + else if ((char*) k1 > (char*) k2) + return 1; + else + return 0; +}