From patchwork Fri Jan 6 10:25:42 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Andrew Burgess X-Patchwork-Id: 62790 Return-Path: X-Original-To: patchwork@sourceware.org Delivered-To: patchwork@sourceware.org Received: from server2.sourceware.org (localhost [IPv6:::1]) by sourceware.org (Postfix) with ESMTP id 412A2382FAE8 for ; Fri, 6 Jan 2023 10:28:05 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 412A2382FAE8 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=sourceware.org; s=default; t=1673000885; bh=gYQwumjxxIedgB1zsCT/v3/Tjx7zR2bxysxd5OwjhlM=; h=To:Cc:Subject:Date:In-Reply-To:References:List-Id: List-Unsubscribe:List-Archive:List-Post:List-Help:List-Subscribe: From:Reply-To:From; b=PzflhWg+i37xb5965fYvvYDLjmeQ9FHRmXnLGQUs1+YZPjbTGmkpYd0P/bCIDslB6 7itfCJ5zeJUPyYOPJsny5HKbeOJysRtgkTgOKT15+rCTXsb0bGzNp5s3fW68oBbFAR ugzeKh7d2d2uYhZLgtfJ9NlCCzyFjHsfIV3qnVtI= X-Original-To: gdb-patches@sourceware.org Delivered-To: gdb-patches@sourceware.org Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.129.124]) by sourceware.org (Postfix) with ESMTPS id 45F56385842B for ; Fri, 6 Jan 2023 10:26:28 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org 45F56385842B Received: from mail-ed1-f71.google.com (mail-ed1-f71.google.com [209.85.208.71]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_128_GCM_SHA256) id us-mta-271-tgOpcYnmMgiIbeWiZr-BCQ-1; Fri, 06 Jan 2023 05:26:26 -0500 X-MC-Unique: tgOpcYnmMgiIbeWiZr-BCQ-1 Received: by mail-ed1-f71.google.com with SMTP id b16-20020a056402279000b0046fb99731e6so964354ede.1 for ; Fri, 06 Jan 2023 02:26:26 -0800 (PST) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=gYQwumjxxIedgB1zsCT/v3/Tjx7zR2bxysxd5OwjhlM=; b=Kzxdge0jN8B6aocp/PsRIRfA9jcrlY2gNobJbLolaqVgtTSbq/1XwjP0chthJKQiHk ZIhYs6LG3mpTPXwCvhMv6JjJqw75U/klzjglrFTEn9Cz2QjfWg9RARRTIqNw10AGR9Y8 e9hcQWtIs0WVQnp/0jwAGoGD/gIjTeiq2fw3ZjhdEkJn+NpnfxBdtzZFnz1y/T4aGPno b5YwJ1SeHfpqLDUCpgrlOZkEINZ3K6tV3n4fMXWgCkuzrdQT05lMjZCG2iaa6N+zZFgu h0w0JPp1JbDLxfaKXRhhNtWCkIEeO5t6nIMkbAgFTz5Gk8qX+wxakDTFNfQSzVKVJqA0 p5tA== X-Gm-Message-State: AFqh2kqz5s4MXu7twrDDNc/INOx1K7YoeL5PG1jscfcQmuCO4+fhcH+u djs1mAjL2bfehh9pIFmK3d4qr4H+BxIjlbS3sYx1DGJDDlQBmDTeaJsVT0p9+RU4iziN8NMR99V TMYPK10O/QbImzPV80AzpEJS9E5MKgBCzXTMOJ9Sc5BNhdZsMk6y19Jg//CHpddlcPzZS6w4Vgg == X-Received: by 2002:a05:6402:f17:b0:489:5852:fbb5 with SMTP id i23-20020a0564020f1700b004895852fbb5mr27705483eda.16.1673000785374; Fri, 06 Jan 2023 02:26:25 -0800 (PST) X-Google-Smtp-Source: AMrXdXtrqnEIj3ws9w3UvAHwJXUDzCK8xgagiAeCV5naSO5mdGmH5V4zxosI+EMTE4r5HyLWTtroXA== X-Received: by 2002:a05:6402:f17:b0:489:5852:fbb5 with SMTP id i23-20020a0564020f1700b004895852fbb5mr27705470eda.16.1673000785147; Fri, 06 Jan 2023 02:26:25 -0800 (PST) Received: from localhost (95.72.115.87.dyn.plus.net. [87.115.72.95]) by smtp.gmail.com with ESMTPSA id u10-20020a1709061daa00b0084cc87c03ebsm271240ejh.110.2023.01.06.02.26.24 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 06 Jan 2023 02:26:24 -0800 (PST) To: gdb-patches@sourceware.org Cc: Andrew Burgess Subject: [PATCH 15/15] gdb/tui: make use of a scoped_restore Date: Fri, 6 Jan 2023 10:25:42 +0000 Message-Id: <086366914f866559bc26512dfc67cf1f9fae2964.1673000632.git.aburgess@redhat.com> X-Mailer: git-send-email 2.25.4 In-Reply-To: References: MIME-Version: 1.0 X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com X-Spam-Status: No, score=-11.9 required=5.0 tests=BAYES_00, DKIMWL_WL_HIGH, DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, DKIM_VALID_EF, GIT_PATCH_0, RCVD_IN_DNSWL_NONE, RCVD_IN_MSPIKE_H2, SPF_HELO_NONE, SPF_NONE, TXREP autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) 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-Patchwork-Original-From: Andrew Burgess via Gdb-patches From: Andrew Burgess Reply-To: Andrew Burgess Errors-To: gdb-patches-bounces+patchwork=sourceware.org@sourceware.org Sender: "Gdb-patches" Make use of a scoped_restore object in tui_mld_read_key instead of doing a manual save/restore. I don't think the existing code can throw an exception, so this is just a cleanup rather than a bug fix. There should be no user visible changes after this commit. --- gdb/tui/tui-io.c | 10 +++------- 1 file changed, 3 insertions(+), 7 deletions(-) diff --git a/gdb/tui/tui-io.c b/gdb/tui/tui-io.c index 2f39e34df2f..a17cf38a1f2 100644 --- a/gdb/tui/tui-io.c +++ b/gdb/tui/tui-io.c @@ -773,14 +773,10 @@ tui_mld_getc (FILE *fp) static int tui_mld_read_key (const struct match_list_displayer *displayer) { - rl_getc_func_t *prev = rl_getc_function; - int c; - /* We can't use tui_getc as we need NEWLINE to not get emitted. */ - rl_getc_function = tui_mld_getc; - c = rl_read_key (); - rl_getc_function = prev; - return c; + scoped_restore restore_getc_function + = make_scoped_restore (&rl_getc_function, tui_mld_getc); + return rl_read_key (); } /* TUI version of rl_completion_display_matches_hook.