public inbox for gdb-cvs@sourceware.org
help / color / mirror / Atom feed
From: Tom Tromey <tromey@sourceware.org>
To: gdb-cvs@sourceware.org
Subject: [binutils-gdb] Simplify the ui-out progress API
Date: Thu, 10 Mar 2022 17:16:59 +0000 (GMT)	[thread overview]
Message-ID: <20220310171659.47C393858D39@sourceware.org> (raw)

https://sourceware.org/git/gitweb.cgi?p=binutils-gdb.git;h=fdda16e1fa9637f9b6ca846eebe881cd2901d75a

commit fdda16e1fa9637f9b6ca846eebe881cd2901d75a
Author: Tom Tromey <tromey@adacore.com>
Date:   Fri Mar 4 11:40:49 2022 -0700

    Simplify the ui-out progress API
    
    I noticed that 'progress' is a method on ui-out, but it seems to me
    that it would be better if the only API were via the progress_meter
    class.  This patch makes this change, changing progress to be a method
    on the meter itself.

Diff:
---
 gdb/debuginfod-support.c |  2 +-
 gdb/ui-out.h             | 14 +++++++-------
 2 files changed, 8 insertions(+), 8 deletions(-)

diff --git a/gdb/debuginfod-support.c b/gdb/debuginfod-support.c
index b44ce67c340..e077e136614 100644
--- a/gdb/debuginfod-support.c
+++ b/gdb/debuginfod-support.c
@@ -129,7 +129,7 @@ progressfn (debuginfod_client *c, long cur, long total)
       data->meter.emplace (current_uiout, message, 1);
     }
 
-  current_uiout->progress ((double)cur / (double)total);
+  data->meter->progress ((double)cur / (double)total);
 
   return 0;
 }
diff --git a/gdb/ui-out.h b/gdb/ui-out.h
index 60dd6fc2d37..cd36211be1f 100644
--- a/gdb/ui-out.h
+++ b/gdb/ui-out.h
@@ -301,18 +301,18 @@ class ui_out
     progress_meter (const progress_meter &) = delete;
     progress_meter &operator= (const progress_meter &) = delete;
 
+    /* Emit some progress for this progress meter.  HOWMUCH may range
+       from 0.0 to 1.0.  */
+    void progress (double howmuch)
+    {
+      m_uiout->do_progress_notify (howmuch);
+    }
+
   private:
 
     struct ui_out *m_uiout;
   };
 
-  /* Emit some progress corresponding to the most recently created
-     progress meter.  HOWMUCH may range from 0.0 to 1.0.  */
-  void progress (double howmuch)
-  {
-    do_progress_notify (howmuch);
-  }
-
  protected:
 
   virtual void do_table_begin (int nbrofcols, int nr_rows, const char *tblid)


                 reply	other threads:[~2022-03-10 17:16 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

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=20220310171659.47C393858D39@sourceware.org \
    --to=tromey@sourceware.org \
    --cc=gdb-cvs@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).