From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: by sourceware.org (Postfix, from userid 2126) id 47C393858D39; Thu, 10 Mar 2022 17:16:59 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 47C393858D39 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable From: Tom Tromey To: gdb-cvs@sourceware.org Subject: [binutils-gdb] Simplify the ui-out progress API X-Act-Checkin: binutils-gdb X-Git-Author: Tom Tromey X-Git-Refname: refs/heads/master X-Git-Oldrev: 00e5d9e9da89cef94810d9d6fdb5bea403269d8d X-Git-Newrev: fdda16e1fa9637f9b6ca846eebe881cd2901d75a Message-Id: <20220310171659.47C393858D39@sourceware.org> Date: Thu, 10 Mar 2022 17:16:59 +0000 (GMT) X-BeenThere: gdb-cvs@sourceware.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Gdb-cvs mailing list List-Unsubscribe: , List-Archive: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 10 Mar 2022 17:16:59 -0000 https://sourceware.org/git/gitweb.cgi?p=3Dbinutils-gdb.git;h=3Dfdda16e1fa96= 37f9b6ca846eebe881cd2901d75a commit fdda16e1fa9637f9b6ca846eebe881cd2901d75a Author: Tom Tromey Date: Fri Mar 4 11:40:49 2022 -0700 Simplify the ui-out progress API =20 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); } =20 - current_uiout->progress ((double)cur / (double)total); + data->meter->progress ((double)cur / (double)total); =20 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 &) =3D delete; progress_meter &operator=3D (const progress_meter &) =3D delete; =20 + /* 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: =20 struct ui_out *m_uiout; }; =20 - /* 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: =20 virtual void do_table_begin (int nbrofcols, int nr_rows, const char *tbl= id)