Change macro_source_fullname to return a std::string

While working on the previous patch, I noticed that if
macro_source_fullname returned a std::string, then the callers would
be simplified.  This patch implements this idea.

gdb/ChangeLog
2019-02-17  Tom Tromey  <tom@tromey.com>

	* macrotab.h (macro_source_fullname): Return a std::string.
	* macrotab.c (macro_include, check_for_redefinition)
	(macro_undef, macro_lookup_definition, foreach_macro)
	(foreach_macro_in_scope): Update.
	(macro_source_fullname): Return a std::string.
	* macrocmd.c (show_pp_source_pos): Update.
This commit is contained in:
Tom Tromey
2019-02-08 01:40:39 -07:00
parent 6506371f06
commit 9409233b0e
4 changed files with 37 additions and 50 deletions

View File

@@ -119,20 +119,16 @@ show_pp_source_pos (struct ui_file *stream,
struct macro_source_file *file,
int line)
{
char *fullname;
fullname = macro_source_fullname (file);
fputs_styled (fullname, file_name_style.style (), stream);
std::string fullname = macro_source_fullname (file);
fputs_styled (fullname.c_str (), file_name_style.style (), stream);
fprintf_filtered (stream, ":%d\n", line);
xfree (fullname);
while (file->included_by)
{
fullname = macro_source_fullname (file->included_by);
fputs_filtered (_(" included at "), stream);
fputs_styled (fullname, file_name_style.style (), stream);
fputs_styled (fullname.c_str (), file_name_style.style (), stream);
fprintf_filtered (stream, ":%d\n", file->included_at_line);
xfree (fullname);
file = file->included_by;
}
}