Remove print_spaces
This removes the print_spaces helper function, in favor of using the "*%s" idiom that's already used in many places in gdb. One spot (in symmisc.c) is changed to use print_spaces_filtered, because the rest of that function is using filtered output. (This highlights one way that the printf idiom is better -- this error is harder to make when using that.) Regression tested on x86-64 Fedora 34.
This commit is contained in:
parent
b0715493df
commit
6bebf813ac
6 changed files with 19 additions and 31 deletions
|
@ -206,7 +206,7 @@ cli_ui_out::do_spaces (int numspaces)
|
|||
return;
|
||||
|
||||
if (test_flags (unfiltered_output))
|
||||
print_spaces (numspaces, m_streams.back ());
|
||||
fprintf_unfiltered (m_streams.back (), "%*s", numspaces, "");
|
||||
else
|
||||
print_spaces_filtered (numspaces, m_streams.back ());
|
||||
}
|
||||
|
|
|
@ -675,7 +675,7 @@ do_compile_dwarf_expr_to_c (int indent, string_file *stream,
|
|||
uint64_t uoffset, reg;
|
||||
int64_t offset;
|
||||
|
||||
print_spaces (indent - 2, stream);
|
||||
stream->printf ("%*s", indent - 2, "");
|
||||
if (info[op_ptr - base].label)
|
||||
{
|
||||
print_label (stream, scope, op_ptr - base);
|
||||
|
|
|
@ -22980,29 +22980,26 @@ dump_die_shallow (struct ui_file *f, int indent, struct die_info *die)
|
|||
{
|
||||
unsigned int i;
|
||||
|
||||
print_spaces (indent, f);
|
||||
fprintf_unfiltered (f, "Die: %s (abbrev %d, offset %s)\n",
|
||||
fprintf_unfiltered (f, "%*sDie: %s (abbrev %d, offset %s)\n",
|
||||
indent, "",
|
||||
dwarf_tag_name (die->tag), die->abbrev,
|
||||
sect_offset_str (die->sect_off));
|
||||
|
||||
if (die->parent != NULL)
|
||||
{
|
||||
print_spaces (indent, f);
|
||||
fprintf_unfiltered (f, " parent at offset: %s\n",
|
||||
fprintf_unfiltered (f, "%*s parent at offset: %s\n",
|
||||
indent, "",
|
||||
sect_offset_str (die->parent->sect_off));
|
||||
}
|
||||
|
||||
print_spaces (indent, f);
|
||||
fprintf_unfiltered (f, " has children: %s\n",
|
||||
fprintf_unfiltered (f, "%*s has children: %s\n",
|
||||
indent, "",
|
||||
dwarf_bool_name (die->child != NULL));
|
||||
|
||||
print_spaces (indent, f);
|
||||
fprintf_unfiltered (f, " attributes:\n");
|
||||
fprintf_unfiltered (f, "%*s attributes:\n", indent, "");
|
||||
|
||||
for (i = 0; i < die->num_attrs; ++i)
|
||||
{
|
||||
print_spaces (indent, f);
|
||||
fprintf_unfiltered (f, " %s (%s) ",
|
||||
fprintf_unfiltered (f, "%*s %s (%s) ",
|
||||
indent, "",
|
||||
dwarf_attr_name (die->attrs[i].name),
|
||||
dwarf_form_name (die->attrs[i].form));
|
||||
|
||||
|
@ -23120,8 +23117,7 @@ dump_die_1 (struct ui_file *f, int level, int max_level, struct die_info *die)
|
|||
|
||||
if (die->child != NULL)
|
||||
{
|
||||
print_spaces (indent, f);
|
||||
fprintf_unfiltered (f, " Children:");
|
||||
fprintf_unfiltered (f, "%*s Children:", indent, "");
|
||||
if (level + 1 < max_level)
|
||||
{
|
||||
fprintf_unfiltered (f, "\n");
|
||||
|
|
|
@ -286,8 +286,8 @@ dump_symtab_1 (struct symtab *symtab, struct ui_file *outfile)
|
|||
{
|
||||
b = BLOCKVECTOR_BLOCK (bv, i);
|
||||
depth = block_depth (b) * 2;
|
||||
print_spaces (depth, outfile);
|
||||
fprintf_filtered (outfile, "block #%03d, object at ", i);
|
||||
fprintf_filtered (outfile, "%*sblock #%03d, object at ",
|
||||
depth, "", i);
|
||||
gdb_print_host_address (b, outfile);
|
||||
if (BLOCK_SUPERBLOCK (b))
|
||||
{
|
||||
|
@ -510,7 +510,7 @@ print_symbol (struct gdbarch *gdbarch, struct symbol *symbol,
|
|||
else
|
||||
section = NULL;
|
||||
|
||||
print_spaces (depth, outfile);
|
||||
print_spaces_filtered (depth, outfile);
|
||||
if (SYMBOL_DOMAIN (symbol) == LABEL_DOMAIN)
|
||||
{
|
||||
fprintf_filtered (outfile, "label %s at ", symbol->print_name ());
|
||||
|
|
|
@ -779,12 +779,6 @@ uinteger_pow (ULONGEST v1, LONGEST v2)
|
|||
}
|
||||
}
|
||||
|
||||
void
|
||||
print_spaces (int n, struct ui_file *file)
|
||||
{
|
||||
fputs_unfiltered (n_spaces (n), file);
|
||||
}
|
||||
|
||||
/* Print a host address. */
|
||||
|
||||
void
|
||||
|
|
|
@ -467,8 +467,6 @@ extern void fprintf_unfiltered (struct ui_file *, const char *, ...)
|
|||
|
||||
extern void printf_unfiltered (const char *, ...) ATTRIBUTE_PRINTF (1, 2);
|
||||
|
||||
extern void print_spaces (int, struct ui_file *);
|
||||
|
||||
extern void print_spaces_filtered (int, struct ui_file *);
|
||||
|
||||
extern const char *n_spaces (int);
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue