forked from Imagelibrary/binutils-gdb
* macroexp.c (init_buffer, gather_arguments, expand): Use NULL, not 0.
* macrotab.c (macro_lookup_inclusion, find_definition, new_macro_table): Same. * macroexp.c (currently_rescanning, expand): Use `strcmp () == 0', not `! strcmp ()'. This is a dubious improvement. * macrotab.c (macro_lookup_inclusion, find_definition): Same. * macrotab.c (macro_lookup_inclusion): Initialize `best_depth', although it's not necessary, to avoid a warning.
This commit is contained in:
@@ -1,3 +1,16 @@
|
|||||||
|
2002-05-14 Jim Blandy <jimb@redhat.com>
|
||||||
|
|
||||||
|
* macroexp.c (init_buffer, gather_arguments, expand): Use NULL, not 0.
|
||||||
|
* macrotab.c (macro_lookup_inclusion, find_definition,
|
||||||
|
new_macro_table): Same.
|
||||||
|
|
||||||
|
* macroexp.c (currently_rescanning, expand): Use `strcmp () == 0',
|
||||||
|
not `! strcmp ()'. This is a dubious improvement.
|
||||||
|
* macrotab.c (macro_lookup_inclusion, find_definition): Same.
|
||||||
|
|
||||||
|
* macrotab.c (macro_lookup_inclusion): Initialize `best_depth',
|
||||||
|
although it's not necessary, to avoid a warning.
|
||||||
|
|
||||||
2002-05-14 Daniel Jacobowitz <drow@mvista.com>
|
2002-05-14 Daniel Jacobowitz <drow@mvista.com>
|
||||||
|
|
||||||
* gdbtypes.h: Update accessor macros to use TYPE_MAIN_TYPE.
|
* gdbtypes.h: Update accessor macros to use TYPE_MAIN_TYPE.
|
||||||
|
|||||||
@@ -88,7 +88,7 @@ init_buffer (struct macro_buffer *b, int n)
|
|||||||
if (n > 0)
|
if (n > 0)
|
||||||
b->text = (char *) xmalloc (n);
|
b->text = (char *) xmalloc (n);
|
||||||
else
|
else
|
||||||
b->text = 0;
|
b->text = NULL;
|
||||||
b->len = 0;
|
b->len = 0;
|
||||||
b->shared = 0;
|
b->shared = 0;
|
||||||
b->last_token = -1;
|
b->last_token = -1;
|
||||||
@@ -646,7 +646,7 @@ static int
|
|||||||
currently_rescanning (struct macro_name_list *list, const char *name)
|
currently_rescanning (struct macro_name_list *list, const char *name)
|
||||||
{
|
{
|
||||||
for (; list; list = list->next)
|
for (; list; list = list->next)
|
||||||
if (! strcmp (name, list->name))
|
if (strcmp (name, list->name) == 0)
|
||||||
return 1;
|
return 1;
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
@@ -692,7 +692,7 @@ gather_arguments (const char *name, struct macro_buffer *src, int *argc_p)
|
|||||||
{
|
{
|
||||||
struct macro_buffer tok;
|
struct macro_buffer tok;
|
||||||
int args_len, args_size;
|
int args_len, args_size;
|
||||||
struct macro_buffer *args = 0;
|
struct macro_buffer *args = NULL;
|
||||||
struct cleanup *back_to = make_cleanup (free_current_contents, &args);
|
struct cleanup *back_to = make_cleanup (free_current_contents, &args);
|
||||||
|
|
||||||
/* Does SRC start with an opening paren token? Read from a copy of
|
/* Does SRC start with an opening paren token? Read from a copy of
|
||||||
@@ -928,12 +928,12 @@ expand (const char *id,
|
|||||||
{
|
{
|
||||||
struct cleanup *back_to = make_cleanup (null_cleanup, 0);
|
struct cleanup *back_to = make_cleanup (null_cleanup, 0);
|
||||||
int argc;
|
int argc;
|
||||||
struct macro_buffer *argv = 0;
|
struct macro_buffer *argv = NULL;
|
||||||
struct macro_buffer substituted;
|
struct macro_buffer substituted;
|
||||||
struct macro_buffer substituted_src;
|
struct macro_buffer substituted_src;
|
||||||
|
|
||||||
if (def->argc >= 1
|
if (def->argc >= 1
|
||||||
&& ! strcmp (def->argv[def->argc - 1], "..."))
|
&& strcmp (def->argv[def->argc - 1], "...") == 0)
|
||||||
error ("Varargs macros not implemented yet.");
|
error ("Varargs macros not implemented yet.");
|
||||||
|
|
||||||
make_cleanup (free_current_contents, &argv);
|
make_cleanup (free_current_contents, &argv);
|
||||||
|
|||||||
@@ -479,7 +479,7 @@ struct macro_source_file *
|
|||||||
macro_lookup_inclusion (struct macro_source_file *source, const char *name)
|
macro_lookup_inclusion (struct macro_source_file *source, const char *name)
|
||||||
{
|
{
|
||||||
/* Is SOURCE itself named NAME? */
|
/* Is SOURCE itself named NAME? */
|
||||||
if (! strcmp (name, source->filename))
|
if (strcmp (name, source->filename) == 0)
|
||||||
return source;
|
return source;
|
||||||
|
|
||||||
/* The filename in the source structure is probably a full path, but
|
/* The filename in the source structure is probably a full path, but
|
||||||
@@ -493,15 +493,15 @@ macro_lookup_inclusion (struct macro_source_file *source, const char *name)
|
|||||||
check for a slash here. */
|
check for a slash here. */
|
||||||
if (name_len < src_name_len
|
if (name_len < src_name_len
|
||||||
&& source->filename[src_name_len - name_len - 1] == '/'
|
&& source->filename[src_name_len - name_len - 1] == '/'
|
||||||
&& ! strcmp (name, source->filename + src_name_len - name_len))
|
&& strcmp (name, source->filename + src_name_len - name_len) == 0)
|
||||||
return source;
|
return source;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* It's not us. Try all our children, and return the lowest. */
|
/* It's not us. Try all our children, and return the lowest. */
|
||||||
{
|
{
|
||||||
struct macro_source_file *child;
|
struct macro_source_file *child;
|
||||||
struct macro_source_file *best = 0;
|
struct macro_source_file *best = NULL;
|
||||||
int best_depth;
|
int best_depth = 0;
|
||||||
|
|
||||||
for (child = source->includes; child; child = child->next_included)
|
for (child = source->includes; child; child = child->next_included)
|
||||||
{
|
{
|
||||||
@@ -618,7 +618,7 @@ find_definition (const char *name,
|
|||||||
query.name = name;
|
query.name = name;
|
||||||
query.start_file = file;
|
query.start_file = file;
|
||||||
query.start_line = line;
|
query.start_line = line;
|
||||||
query.end_file = 0;
|
query.end_file = NULL;
|
||||||
|
|
||||||
n = splay_tree_lookup (t->definitions, (splay_tree_key) &query);
|
n = splay_tree_lookup (t->definitions, (splay_tree_key) &query);
|
||||||
if (! n)
|
if (! n)
|
||||||
@@ -638,7 +638,7 @@ find_definition (const char *name,
|
|||||||
We just want to search within a given name's definitions. */
|
We just want to search within a given name's definitions. */
|
||||||
struct macro_key *found = (struct macro_key *) pred->key;
|
struct macro_key *found = (struct macro_key *) pred->key;
|
||||||
|
|
||||||
if (! strcmp (found->name, name))
|
if (strcmp (found->name, name) == 0)
|
||||||
n = pred;
|
n = pred;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -838,7 +838,7 @@ new_macro_table (struct obstack *obstack,
|
|||||||
memset (t, 0, sizeof (*t));
|
memset (t, 0, sizeof (*t));
|
||||||
t->obstack = obstack;
|
t->obstack = obstack;
|
||||||
t->bcache = b;
|
t->bcache = b;
|
||||||
t->main_source = 0;
|
t->main_source = NULL;
|
||||||
t->definitions = (splay_tree_new_with_allocator
|
t->definitions = (splay_tree_new_with_allocator
|
||||||
(macro_tree_compare,
|
(macro_tree_compare,
|
||||||
((splay_tree_delete_key_fn) macro_tree_delete_key),
|
((splay_tree_delete_key_fn) macro_tree_delete_key),
|
||||||
|
|||||||
Reference in New Issue
Block a user