public inbox for gdb-patches@sourceware.org
 help / color / mirror / Atom feed
From: Tom Tromey <tom@tromey.com>
To: gdb-patches@sourceware.org
Cc: Tom Tromey <tom@tromey.com>
Subject: [PATCH 4/4] Remove global wrap_here function
Date: Fri, 31 Dec 2021 15:25:27 -0700	[thread overview]
Message-ID: <20211231222527.2930519-5-tom@tromey.com> (raw)
In-Reply-To: <20211231222527.2930519-1-tom@tromey.com>

This removes the global wrap_here function, so that future calls
cannot be introduced.  Instead, all callers must use the method on the
appropriate ui_file.

This temporarily moves the implementation of this method to utils.c.
This will change once the remaining patches to untangle the pager have
been written.
---
 gdb/ui-file.c |  6 ------
 gdb/utils.c   | 20 +++-----------------
 2 files changed, 3 insertions(+), 23 deletions(-)

diff --git a/gdb/ui-file.c b/gdb/ui-file.c
index bde90a9e6ed..eb1d72bf8b3 100644
--- a/gdb/ui-file.c
+++ b/gdb/ui-file.c
@@ -68,12 +68,6 @@ ui_file::vprintf (const char *format, va_list args)
   vfprintf_unfiltered (this, format, args);
 }
 
-void
-ui_file::wrap_here (int indent)
-{
-  ::wrap_here (indent);
-}
-
 \f
 
 void
diff --git a/gdb/utils.c b/gdb/utils.c
index eebdfd57963..5c14cb2268c 100644
--- a/gdb/utils.c
+++ b/gdb/utils.c
@@ -1615,29 +1615,15 @@ get_chars_per_line ()
   return chars_per_line;
 }
 
-/* Indicate that if the next sequence of characters overflows the
-   line, a newline should be inserted here rather than when it hits
-   the end.  If INDENT is non-zero, it is a number of spaces to be
-   printed to indent the wrapped part on the next line.
-
-   If the line is already overfull, we immediately print a newline and
-   the indentation, and disable further wrapping.
-
-   If we don't know the width of lines, but we know the page height,
-   we must not wrap words, but should still keep track of newlines
-   that were explicitly printed.
-
-   This routine is guaranteed to force out any output which has been
-   squirreled away in the wrap_buffer, so wrap_here (0) can be
-   used to force out output from the wrap_buffer.  */
+/* See ui-file.h.  */
 
 void
-wrap_here (int indent)
+ui_file::wrap_here (int indent)
 {
   /* This should have been allocated, but be paranoid anyway.  */
   gdb_assert (filter_initialized);
 
-  flush_wrap_buffer (gdb_stdout);
+  flush_wrap_buffer (this);
   if (chars_per_line == UINT_MAX)	/* No line overflow checking.  */
     {
       wrap_column = 0;
-- 
2.31.1


  parent reply	other threads:[~2021-12-31 22:25 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-12-31 22:25 [PATCH 0/4] Clean up wrap_here function a little Tom Tromey
2021-12-31 22:25 ` [PATCH 1/4] Convert wrap_here to use integer parameter Tom Tromey
2021-12-31 22:25 ` [PATCH 2/4] Add ui_file::wrap_here Tom Tromey
2021-12-31 22:25 ` [PATCH 3/4] Always call the wrap_here method Tom Tromey
2021-12-31 22:25 ` Tom Tromey [this message]
2022-01-26 22:21 ` [PATCH 0/4] Clean up wrap_here function a little Tom Tromey

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20211231222527.2930519-5-tom@tromey.com \
    --to=tom@tromey.com \
    --cc=gdb-patches@sourceware.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).