From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mail-io1-xd33.google.com (mail-io1-xd33.google.com [IPv6:2607:f8b0:4864:20::d33]) by sourceware.org (Postfix) with ESMTPS id 6A7CB3857C62 for ; Fri, 4 Mar 2022 19:30:35 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.1 sourceware.org 6A7CB3857C62 Received: by mail-io1-xd33.google.com with SMTP id w7so10701689ioj.5 for ; Fri, 04 Mar 2022 11:30:35 -0800 (PST) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:from:to:cc:subject:date:message-id:mime-version :content-transfer-encoding; bh=8Sfi8kwKzoQRa2H9UsF41P80+X+q+YVoSWmrLrCrXfQ=; b=bvbVjzBN5S0vY2Y6APffq8yaQ747ucKfb0werfy0nw6KCyZNNAiGLoJV7LWQdLjgtG 93ei7iqexxguIf2izsh2t9OIAAbMi6fJIauyqu58uI38go9G9n62cDqoUBC1/LTGyNKd 1RRcm5eQirnZ/4omI+3qYsrq5RhJBL3sImVpwm+Vriabds6+GW0hUyvculR0KLGbpo+T f+h89QCgG8jMI4LaWcBZ8rAddAf1A2MFsDyUFACTOr0aN7dfTREmRtsLec+CzHd5KOJP mst2ZVdtuO7PZPphvuD8aax/RZsonH8iu9pl+VaXAlJdy6cCSE2PhbbepGBpSKZiDae1 YGDg== X-Gm-Message-State: AOAM531uDoX0blzWM/lVDJ6PXhQ0lfdRyI5Q5mUU39J8t7SBgoMTkd0N r2RB04RzBSnTj/kMPZHKgKAyntaDkAPg8w== X-Google-Smtp-Source: ABdhPJz3/2QY0EhdnHbDJbWujswS/egrwFzT71lKMqCR8qUjxGEpgHuevDAU0bSOUWWC9Hw3lBs/wg== X-Received: by 2002:a05:6638:3282:b0:30d:d9c7:36cf with SMTP id f2-20020a056638328200b0030dd9c736cfmr64976jav.251.1646422234866; Fri, 04 Mar 2022 11:30:34 -0800 (PST) Received: from murgatroyd.Home (75-166-141-253.hlrn.qwest.net. [75.166.141.253]) by smtp.gmail.com with ESMTPSA id o21-20020a05660213d500b006459bf16f68sm57547iov.48.2022.03.04.11.30.34 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 04 Mar 2022 11:30:34 -0800 (PST) From: Tom Tromey To: gdb-patches@sourceware.org Cc: Aaron Merey , Tom Tromey Subject: [PATCH] Simplify the ui-out progress API Date: Fri, 4 Mar 2022 12:30:15 -0700 Message-Id: <20220304193015.1940131-1-tromey@adacore.com> X-Mailer: git-send-email 2.34.1 MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Spam-Status: No, score=-11.5 required=5.0 tests=BAYES_00, DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, DKIM_VALID_EF, GIT_PATCH_0, RCVD_IN_DNSWL_NONE, SPF_HELO_NONE, SPF_PASS, TXREP, T_SCC_BODY_TEXT_LINE autolearn=ham autolearn_force=no version=3.4.4 X-Spam-Checker-Version: SpamAssassin 3.4.4 (2020-01-24) on server2.sourceware.org X-BeenThere: gdb-patches@sourceware.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Gdb-patches mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 04 Mar 2022 19:30:36 -0000 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. --- 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 56d8e7781c5..deb1c24d5ed 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) -- 2.34.1