* Makefile.am (stamp-m32r): Fix path to cpu files.
[deliverable/binutils-gdb.git] / libiberty / ternary.c
index c5ef3a58b7638b00f7bec0cbf4d50e1f03e2836a..8fc561a4531530eb7fa373b9a77c56e21359bf84 100644 (file)
@@ -15,7 +15,7 @@
 
    You should have received a copy of the GNU General Public License
    along with this program; if not, write to the Free Software
-   Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307,
+   Foundation, Inc., 51 Franklin Street - Fifth Floor, Boston, MA 02110-1301,
    USA.  */
 #ifdef HAVE_CONFIG_H
 #include "config.h"
@@ -33,8 +33,8 @@
 /* Non-recursive so we don't waste stack space/time on large
    insertions. */
 
-void *
-ternary_insert (ternary_tree * root, char *s, void *data, int replace)
+PTR
+ternary_insert (ternary_tree *root, const char *s, PTR data, int replace)
 {
   int diff;
   ternary_tree curr, *pcurr;
@@ -54,7 +54,7 @@ ternary_insert (ternary_tree * root, char *s, void *data, int replace)
            {
              if (replace)
                curr->eqkid = (ternary_tree) data;
-             return (void *) curr->eqkid;
+             return (PTR) curr->eqkid;
            }
          pcurr = &(curr->eqkid);
        }
@@ -74,7 +74,7 @@ ternary_insert (ternary_tree * root, char *s, void *data, int replace)
   for (;;)
     {
       /* Allocate the memory for the node, and fill it in */
-      *pcurr = (ternary_tree) xmalloc (sizeof (ternary_node));
+      *pcurr = XNEW (ternary_node);
       curr = *pcurr;
       curr->splitchar = *s;
       curr->lokid = curr->hikid = curr->eqkid = 0;
@@ -107,10 +107,10 @@ ternary_cleanup (ternary_tree p)
 }
 
 /* Non-recursive find of a string in the ternary tree */
-void *
-ternary_search (ternary_tree p, char *s)
+PTR
+ternary_search (const ternary_node *p, const char *s)
 {
-  ternary_tree curr;
+  const ternary_node *curr;
   int diff, spchar;
   spchar = *s;
   curr = p;
@@ -123,7 +123,7 @@ ternary_search (ternary_tree p, char *s)
       if (diff == 0)
        {
          if (spchar == 0)
-           return (void *) curr->eqkid;
+           return (PTR) curr->eqkid;
          spchar = *++s;
          curr = curr->eqkid;
        }
@@ -139,8 +139,8 @@ ternary_search (ternary_tree p, char *s)
 
 /* For those who care, the recursive version of the search. Useful if
    you want a starting point for pmsearch or nearsearch. */
-static void *
-ternary_recursivesearch (ternary_tree p, char *s)
+static PTR
+ternary_recursivesearch (const ternary_node *p, const char *s)
 {
   if (!p)
     return 0;
@@ -151,7 +151,7 @@ ternary_recursivesearch (ternary_tree p, char *s)
   else
     {
       if (*s == 0)
-       return (void *) p->eqkid;
+       return (PTR) p->eqkid;
       return ternary_recursivesearch (p->eqkid, ++s);
     }
 }
This page took 0.024016 seconds and 4 git commands to generate.