aboutsummaryrefslogtreecommitdiff
path: root/libiberty/ternary.c
diff options
context:
space:
mode:
authorZack Weinberg <zackw@stanford.edu>2001-05-08 06:13:58 +0000
committerZack Weinberg <zackw@stanford.edu>2001-05-08 06:13:58 +0000
commitb452fad33fcbe900b034d0207d8dab7421c0a623 (patch)
treecb279795efc4e5b734fb92e5aa50763824cde776 /libiberty/ternary.c
parent1cf16e4b9e33990dd7034e4ad24fafd3c8459b22 (diff)
* cp-demangle.c (demangle_v3_with_details,
is_gnu_v3_mangled_ctor, is_gnu_v3_mangled_dtor): Use K+R style function definition. * ternary.c: Use K+R style function definitions. Use PTR, not void *. Make arguments constant where possible. * demangle.h: Use PARAMS for all prototypes. * ternary.h: Use PARAMS for all prototypes. Use PTR, not void *. Make arguments constant where possible. git-svn-id: https://gcc.gnu.org/svn/gcc/trunk@41910 138bc75d-0d04-0410-961f-82ee72b054a4
Diffstat (limited to 'libiberty/ternary.c')
-rw-r--r--libiberty/ternary.c31
1 files changed, 20 insertions, 11 deletions
diff --git a/libiberty/ternary.c b/libiberty/ternary.c
index c5ef3a58b76..056d2cee11e 100644
--- a/libiberty/ternary.c
+++ b/libiberty/ternary.c
@@ -33,8 +33,12 @@
/* 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 (root, s, data, replace)
+ ternary_tree *root;
+ const char *s;
+ PTR data;
+ int replace;
{
int diff;
ternary_tree curr, *pcurr;
@@ -54,7 +58,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);
}
@@ -94,7 +98,8 @@ ternary_insert (ternary_tree * root, char *s, void *data, int replace)
/* Free the ternary search tree rooted at p. */
void
-ternary_cleanup (ternary_tree p)
+ternary_cleanup (p)
+ ternary_tree p;
{
if (p)
{
@@ -107,10 +112,12 @@ 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 (p, s)
+ const ternary_node *p;
+ const char *s;
{
- ternary_tree curr;
+ const ternary_node *curr;
int diff, spchar;
spchar = *s;
curr = p;
@@ -123,7 +130,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 +146,10 @@ 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 (p, s)
+ const ternary_node *p;
+ const char *s;
{
if (!p)
return 0;
@@ -151,7 +160,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);
}
}