From 0426ad513f93bb1c5805988e60d6f87fbe738860 Mon Sep 17 00:00:00 2001 From: Tom Tromey Date: Sun, 2 Jan 2022 11:36:44 -0700 Subject: Unify gdb puts functions Now that filtered and unfiltered output can be treated identically, we can unify the puts family of functions. This is done under the name "gdb_puts". Most of this patch was written by script. --- gdb/guile/scm-ports.c | 2 +- gdb/guile/scm-pretty-print.c | 28 ++++++++++++++-------------- 2 files changed, 15 insertions(+), 15 deletions(-) (limited to 'gdb/guile') diff --git a/gdb/guile/scm-ports.c b/gdb/guile/scm-ports.c index dde7882..c61ca1d 100644 --- a/gdb/guile/scm-ports.c +++ b/gdb/guile/scm-ports.c @@ -202,7 +202,7 @@ fputsn_filtered (const char *s, size_t size, struct ui_file *stream) for (i = 0; i < size; ++i) { if (s[i] == '\0') - fputs_filtered ("\\000", stream); + gdb_puts ("\\000", stream); else fputc_filtered (s[i], stream); } diff --git a/gdb/guile/scm-pretty-print.c b/gdb/guile/scm-pretty-print.c index c64e834..8a5c02d 100644 --- a/gdb/guile/scm-pretty-print.c +++ b/gdb/guile/scm-pretty-print.c @@ -687,7 +687,7 @@ ppscm_print_string_repr (SCM printer, enum display_hint hint, for (i = 0; i < length; ++i) { if (string.get ()[i] == '\0') - fputs_filtered ("\\000", stream); + gdb_puts ("\\000", stream); else fputc_filtered (string.get ()[i], stream); } @@ -826,10 +826,10 @@ ppscm_print_children (SCM printer, enum display_hint hint, if (i == 0) { if (!printed_nothing) - fputs_filtered (" = ", stream); + gdb_puts (" = ", stream); } else if (! is_map || i % 2 == 0) - fputs_filtered (pretty ? "," : ", ", stream); + gdb_puts (pretty ? "," : ", ", stream); /* Skip printing children if max_depth has been reached. This check is performed after print_string_repr and the "=" separator so that @@ -839,7 +839,7 @@ ppscm_print_children (SCM printer, enum display_hint hint, goto done; else if (i == 0) /* Print initial "{" to bookend children. */ - fputs_filtered ("{", stream); + gdb_puts ("{", stream); /* In summary mode, we just want to print "= {...}" if there is a value. */ @@ -857,7 +857,7 @@ ppscm_print_children (SCM printer, enum display_hint hint, { if (pretty) { - fputs_filtered ("\n", stream); + gdb_puts ("\n", stream); print_spaces_filtered (2 + 2 * recurse, stream); } else @@ -865,7 +865,7 @@ ppscm_print_children (SCM printer, enum display_hint hint, } if (is_map && i % 2 == 0) - fputs_filtered ("[", stream); + gdb_puts ("[", stream); else if (is_array) { /* We print the index, not whatever the child method @@ -875,8 +875,8 @@ ppscm_print_children (SCM printer, enum display_hint hint, } else if (! is_map) { - fputs_filtered (name.get (), stream); - fputs_filtered (" = ", stream); + gdb_puts (name.get (), stream); + gdb_puts (" = ", stream); } if (lsscm_is_lazy_string (v_scm)) @@ -890,7 +890,7 @@ ppscm_print_children (SCM printer, enum display_hint hint, { gdb::unique_xmalloc_ptr output = gdbscm_scm_to_c_string (v_scm); - fputs_filtered (output.get (), stream); + gdb_puts (output.get (), stream); } else { @@ -920,7 +920,7 @@ ppscm_print_children (SCM printer, enum display_hint hint, } if (is_map && i % 2 == 0) - fputs_filtered ("] = ", stream); + gdb_puts ("] = ", stream); } if (i) @@ -929,17 +929,17 @@ ppscm_print_children (SCM printer, enum display_hint hint, { if (pretty) { - fputs_filtered ("\n", stream); + gdb_puts ("\n", stream); print_spaces_filtered (2 + 2 * recurse, stream); } - fputs_filtered ("...", stream); + gdb_puts ("...", stream); } if (pretty) { - fputs_filtered ("\n", stream); + gdb_puts ("\n", stream); print_spaces_filtered (2 * recurse, stream); } - fputs_filtered ("}", stream); + gdb_puts ("}", stream); } done: -- cgit v1.1