Commit 641b2721 by Zack Weinberg Committed by Zack Weinberg

cp-demangle.c (demangle_v3_with_details, [...]): Use K+R style function definition.

	* 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.

From-SVN: r41910
parent ee2f20b9
2001-05-07 Zack Weinberg <zackw@stanford.edu>
* demangle.h: Use PARAMS for all prototypes.
* ternary.h: Use PARAMS for all prototypes. Use PTR, not void *.
Make arguments constant where possible.
2001-05-07 Mark Mitchell <mark@codesourcery.com> 2001-05-07 Mark Mitchell <mark@codesourcery.com>
* splay-tree.h (splay_tree_max): New function. * splay-tree.h (splay_tree_max): New function.
......
...@@ -139,7 +139,8 @@ enum gnu_v3_ctor_kinds { ...@@ -139,7 +139,8 @@ enum gnu_v3_ctor_kinds {
in the G++ V3 ABI demangling style. Specifically, return an `enum in the G++ V3 ABI demangling style. Specifically, return an `enum
gnu_v3_ctor_kinds' value indicating what kind of constructor gnu_v3_ctor_kinds' value indicating what kind of constructor
it is. */ it is. */
extern enum gnu_v3_ctor_kinds is_gnu_v3_mangled_ctor (const char *name); extern enum gnu_v3_ctor_kinds
is_gnu_v3_mangled_ctor PARAMS ((const char *name));
enum gnu_v3_dtor_kinds { enum gnu_v3_dtor_kinds {
...@@ -152,6 +153,7 @@ enum gnu_v3_dtor_kinds { ...@@ -152,6 +153,7 @@ enum gnu_v3_dtor_kinds {
in the G++ V3 ABI demangling style. Specifically, return an `enum in the G++ V3 ABI demangling style. Specifically, return an `enum
gnu_v3_dtor_kinds' value, indicating what kind of destructor gnu_v3_dtor_kinds' value, indicating what kind of destructor
it is. */ it is. */
extern enum gnu_v3_dtor_kinds is_gnu_v3_mangled_dtor (const char *name); extern enum gnu_v3_dtor_kinds
is_gnu_v3_mangled_dtor PARAMS ((const char *name));
#endif /* DEMANGLE_H */ #endif /* DEMANGLE_H */
...@@ -38,13 +38,14 @@ ternary_node; ...@@ -38,13 +38,14 @@ ternary_node;
already there, and replace is 0. already there, and replace is 0.
Otherwise, replaces if it it exists, inserts if it doesn't, and Otherwise, replaces if it it exists, inserts if it doesn't, and
returns the data you passed in. */ returns the data you passed in. */
void *ternary_insert (ternary_tree *p, char *s, void *data, int replace); PTR ternary_insert PARAMS ((ternary_tree *p, const char *s,
PTR data, int replace));
/* Delete the ternary search tree rooted at P. /* Delete the ternary search tree rooted at P.
Does NOT delete the data you associated with the strings. */ Does NOT delete the data you associated with the strings. */
void ternary_cleanup (ternary_tree p); void ternary_cleanup PARAMS ((ternary_tree p));
/* Search the ternary tree for string S, returning the data associated /* Search the ternary tree for string S, returning the data associated
with it if found. */ with it if found. */
void *ternary_search (ternary_tree p, char *s); PTR ternary_search PARAMS ((const ternary_node *p, const char *s));
#endif #endif
2001-05-07 Zack Weinberg <zackw@stanford.edu>
* 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.
2001-05-07 Mark Mitchell <mark@codesourcery.com> 2001-05-07 Mark Mitchell <mark@codesourcery.com>
* splay-tree.h (splay_tree_max): New function. * splay-tree.h (splay_tree_max): New function.
......
...@@ -3819,7 +3819,8 @@ java_demangle_v3 (mangled) ...@@ -3819,7 +3819,8 @@ java_demangle_v3 (mangled)
zero, indicating that some error occurred, or a demangling_t zero, indicating that some error occurred, or a demangling_t
holding the results. */ holding the results. */
static demangling_t static demangling_t
demangle_v3_with_details (const char *name) demangle_v3_with_details (name)
const char *name;
{ {
demangling_t dm; demangling_t dm;
status_t status; status_t status;
...@@ -3857,7 +3858,8 @@ demangle_v3_with_details (const char *name) ...@@ -3857,7 +3858,8 @@ demangle_v3_with_details (const char *name)
- '2' if NAME is a base object constructor, or - '2' if NAME is a base object constructor, or
- '3' if NAME is a complete object allocating constructor. */ - '3' if NAME is a complete object allocating constructor. */
enum gnu_v3_ctor_kinds enum gnu_v3_ctor_kinds
is_gnu_v3_mangled_ctor (const char *name) is_gnu_v3_mangled_ctor (name)
const char *name;
{ {
demangling_t dm = demangle_v3_with_details (name); demangling_t dm = demangle_v3_with_details (name);
...@@ -3878,7 +3880,8 @@ is_gnu_v3_mangled_ctor (const char *name) ...@@ -3878,7 +3880,8 @@ is_gnu_v3_mangled_ctor (const char *name)
- '1' if NAME is a complete object destructor, or - '1' if NAME is a complete object destructor, or
- '2' if NAME is a base object destructor. */ - '2' if NAME is a base object destructor. */
enum gnu_v3_dtor_kinds enum gnu_v3_dtor_kinds
is_gnu_v3_mangled_dtor (const char *name) is_gnu_v3_mangled_dtor (name)
const char *name;
{ {
demangling_t dm = demangle_v3_with_details (name); demangling_t dm = demangle_v3_with_details (name);
......
...@@ -33,8 +33,12 @@ ...@@ -33,8 +33,12 @@
/* Non-recursive so we don't waste stack space/time on large /* Non-recursive so we don't waste stack space/time on large
insertions. */ insertions. */
void * PTR
ternary_insert (ternary_tree * root, char *s, void *data, int replace) ternary_insert (root, s, data, replace)
ternary_tree *root;
const char *s;
PTR data;
int replace;
{ {
int diff; int diff;
ternary_tree curr, *pcurr; ternary_tree curr, *pcurr;
...@@ -54,7 +58,7 @@ ternary_insert (ternary_tree * root, char *s, void *data, int replace) ...@@ -54,7 +58,7 @@ ternary_insert (ternary_tree * root, char *s, void *data, int replace)
{ {
if (replace) if (replace)
curr->eqkid = (ternary_tree) data; curr->eqkid = (ternary_tree) data;
return (void *) curr->eqkid; return (PTR) curr->eqkid;
} }
pcurr = &(curr->eqkid); pcurr = &(curr->eqkid);
} }
...@@ -94,7 +98,8 @@ ternary_insert (ternary_tree * root, char *s, void *data, int replace) ...@@ -94,7 +98,8 @@ ternary_insert (ternary_tree * root, char *s, void *data, int replace)
/* Free the ternary search tree rooted at p. */ /* Free the ternary search tree rooted at p. */
void void
ternary_cleanup (ternary_tree p) ternary_cleanup (p)
ternary_tree p;
{ {
if (p) if (p)
{ {
...@@ -107,10 +112,12 @@ ternary_cleanup (ternary_tree p) ...@@ -107,10 +112,12 @@ ternary_cleanup (ternary_tree p)
} }
/* Non-recursive find of a string in the ternary tree */ /* Non-recursive find of a string in the ternary tree */
void * PTR
ternary_search (ternary_tree p, char *s) ternary_search (p, s)
const ternary_node *p;
const char *s;
{ {
ternary_tree curr; const ternary_node *curr;
int diff, spchar; int diff, spchar;
spchar = *s; spchar = *s;
curr = p; curr = p;
...@@ -123,7 +130,7 @@ ternary_search (ternary_tree p, char *s) ...@@ -123,7 +130,7 @@ ternary_search (ternary_tree p, char *s)
if (diff == 0) if (diff == 0)
{ {
if (spchar == 0) if (spchar == 0)
return (void *) curr->eqkid; return (PTR) curr->eqkid;
spchar = *++s; spchar = *++s;
curr = curr->eqkid; curr = curr->eqkid;
} }
...@@ -139,8 +146,10 @@ ternary_search (ternary_tree p, char *s) ...@@ -139,8 +146,10 @@ ternary_search (ternary_tree p, char *s)
/* For those who care, the recursive version of the search. Useful if /* For those who care, the recursive version of the search. Useful if
you want a starting point for pmsearch or nearsearch. */ you want a starting point for pmsearch or nearsearch. */
static void * static PTR
ternary_recursivesearch (ternary_tree p, char *s) ternary_recursivesearch (p, s)
const ternary_node *p;
const char *s;
{ {
if (!p) if (!p)
return 0; return 0;
...@@ -151,7 +160,7 @@ ternary_recursivesearch (ternary_tree p, char *s) ...@@ -151,7 +160,7 @@ ternary_recursivesearch (ternary_tree p, char *s)
else else
{ {
if (*s == 0) if (*s == 0)
return (void *) p->eqkid; return (PTR) p->eqkid;
return ternary_recursivesearch (p->eqkid, ++s); return ternary_recursivesearch (p->eqkid, ++s);
} }
} }
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment