mirror of
https://github.com/espressif/binutils-gdb.git
synced 2025-10-18 21:34:13 +08:00
Use gdbfmt for vprintf_filtered.
gdbfmt was already used for printf_filtered, so using it for vprintf_filtered is more consistent. As a result, all callers of vfprintf_maybe_filtered now use gdbfmt, so the function can be simplified to assume the gdbfmt case and remove the associated bool argument. Similary, vprintf_filtered is now a simple wrapper around vfprintf_filtered.
This commit is contained in:
26
gdb/utils.c
26
gdb/utils.c
@ -81,7 +81,7 @@ void (*deprecated_error_begin_hook) (void);
|
|||||||
/* Prototypes for local functions */
|
/* Prototypes for local functions */
|
||||||
|
|
||||||
static void vfprintf_maybe_filtered (struct ui_file *, const char *,
|
static void vfprintf_maybe_filtered (struct ui_file *, const char *,
|
||||||
va_list, bool, bool)
|
va_list, bool)
|
||||||
ATTRIBUTE_PRINTF (2, 0);
|
ATTRIBUTE_PRINTF (2, 0);
|
||||||
|
|
||||||
static void fputs_maybe_filtered (const char *, struct ui_file *, int);
|
static void fputs_maybe_filtered (const char *, struct ui_file *, int);
|
||||||
@ -2102,27 +2102,19 @@ puts_debug (char *prefix, char *string, char *suffix)
|
|||||||
|
|
||||||
static void
|
static void
|
||||||
vfprintf_maybe_filtered (struct ui_file *stream, const char *format,
|
vfprintf_maybe_filtered (struct ui_file *stream, const char *format,
|
||||||
va_list args, bool filter, bool gdbfmt)
|
va_list args, bool filter)
|
||||||
{
|
{
|
||||||
if (gdbfmt)
|
ui_out_flags flags = disallow_ui_out_field;
|
||||||
{
|
if (!filter)
|
||||||
ui_out_flags flags = disallow_ui_out_field;
|
flags |= unfiltered_output;
|
||||||
if (!filter)
|
cli_ui_out (stream, flags).vmessage (applied_style, format, args);
|
||||||
flags |= unfiltered_output;
|
|
||||||
cli_ui_out (stream, flags).vmessage (applied_style, format, args);
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
std::string str = string_vprintf (format, args);
|
|
||||||
fputs_maybe_filtered (str.c_str (), stream, filter);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void
|
void
|
||||||
vfprintf_filtered (struct ui_file *stream, const char *format, va_list args)
|
vfprintf_filtered (struct ui_file *stream, const char *format, va_list args)
|
||||||
{
|
{
|
||||||
vfprintf_maybe_filtered (stream, format, args, true, true);
|
vfprintf_maybe_filtered (stream, format, args, true);
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
@ -2156,13 +2148,13 @@ vfprintf_unfiltered (struct ui_file *stream, const char *format, va_list args)
|
|||||||
needs_timestamp = (len > 0 && linebuffer[len - 1] == '\n');
|
needs_timestamp = (len > 0 && linebuffer[len - 1] == '\n');
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
vfprintf_maybe_filtered (stream, format, args, false, true);
|
vfprintf_maybe_filtered (stream, format, args, false);
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
vprintf_filtered (const char *format, va_list args)
|
vprintf_filtered (const char *format, va_list args)
|
||||||
{
|
{
|
||||||
vfprintf_maybe_filtered (gdb_stdout, format, args, true, false);
|
vfprintf_filtered (gdb_stdout, format, args);
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
|
Reference in New Issue
Block a user