From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from simark.ca by simark.ca with LMTP id uCMZEPkCWWRWyQIAWB0awg (envelope-from ) for ; Mon, 08 May 2023 10:11:05 -0400 Received: by simark.ca (Postfix, from userid 112) id 3EA391E11D; Mon, 8 May 2023 10:11:05 -0400 (EDT) Authentication-Results: simark.ca; dkim=pass (1024-bit key; secure) header.d=sourceware.org header.i=@sourceware.org header.a=rsa-sha256 header.s=default header.b=B40CxSBF; dkim-atps=neutral X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on simark.ca X-Spam-Level: X-Spam-Status: No, score=-5.3 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,MAILING_LIST_MULTI,RCVD_IN_DNSWL_MED, URIBL_BLOCKED autolearn=ham autolearn_force=no version=3.4.6 Received: from sourceware.org (server2.sourceware.org [8.43.85.97]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by simark.ca (Postfix) with ESMTPS id BDAE51E114 for ; Mon, 8 May 2023 10:11:04 -0400 (EDT) Received: from server2.sourceware.org (localhost [IPv6:::1]) by sourceware.org (Postfix) with ESMTP id 211C9385696A for ; Mon, 8 May 2023 14:11:04 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 211C9385696A DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=sourceware.org; s=default; t=1683555064; bh=SI3uMXZt+pwAVnsVuWxD41xy2O75vTFDrWxOxeiWv+I=; 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=B40CxSBFiQt0asCuf72LuLyHourKJJYELh7t/edFLaQodz8qx/VDMP/g4RURIXGtx uQWB60UaGYr/2vCQZQp1kv2RBFx3YKRrS0OSP1VhF3huY7Sc5Z8R4MoncPSvLfKDVf hTt9i3lGUsJmUegBR2JFZPK60eOlHU3d39QHWJB8= Received: from smtp-out2.suse.de (smtp-out2.suse.de [IPv6:2001:67c:2178:6::1d]) by sourceware.org (Postfix) with ESMTPS id 7C3723858C36 for ; Mon, 8 May 2023 14:10:40 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org 7C3723858C36 Received: from imap2.suse-dmz.suse.de (imap2.suse-dmz.suse.de [192.168.254.74]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (P-521) server-digest SHA512) (No client certificate requested) by smtp-out2.suse.de (Postfix) with ESMTPS id B26F41FF47; Mon, 8 May 2023 14:10:39 +0000 (UTC) Received: from imap2.suse-dmz.suse.de (imap2.suse-dmz.suse.de [192.168.254.74]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (P-521) server-digest SHA512) (No client certificate requested) by imap2.suse-dmz.suse.de (Postfix) with ESMTPS id 62BD21346B; Mon, 8 May 2023 14:10:39 +0000 (UTC) Received: from dovecot-director2.suse.de ([192.168.254.65]) by imap2.suse-dmz.suse.de with ESMTPSA id uI4EFN8CWWSpAwAAMHmgww (envelope-from ); Mon, 08 May 2023 14:10:39 +0000 To: gdb-patches@sourceware.org Cc: Tom Tromey Subject: [PATCH 2/3] [gdb/tui] Fix buglet in set_border_kind_item Date: Mon, 8 May 2023 16:10:35 +0200 Message-Id: <20230508141036.22723-3-tdevries@suse.de> X-Mailer: git-send-email 2.35.3 In-Reply-To: <20230508141036.22723-1-tdevries@suse.de> References: <20230508141036.22723-1-tdevries@suse.de> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit 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: , From: Tom de Vries via Gdb-patches Reply-To: Tom de Vries Errors-To: gdb-patches-bounces+public-inbox=simark.ca@sourceware.org Sender: "Gdb-patches" While factoring out set_border_kind_item I noticed a buglet: ... struct tui_translate *entry = translate (key, dict); if (*lval != (chtype) entry->value) { *lval = (entry->value < 0) ? acs : entry->value; ... When assigning the new value to *lval, an entry->value of -1 is taken into account, but not when comparing to the current value of *lval. Fix this by introducing: ... int val = (entry->value < 0) ? acs : entry->value; ... and using this in both comparison and assignment. Tested on x86_64-linux. --- gdb/tui/tui-win.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/gdb/tui/tui-win.c b/gdb/tui/tui-win.c index cf4cb920524..fedcac4b560 100644 --- a/gdb/tui/tui-win.c +++ b/gdb/tui/tui-win.c @@ -300,10 +300,11 @@ set_border_kind_item (chtype *lval, const char *key, struct tui_translate *dict, int acs, bool *lval_changed) { struct tui_translate *entry = translate (key, dict); + int val = (entry->value < 0) ? acs : entry->value; - if (*lval != (chtype) entry->value) + if (*lval != (chtype) val) { - *lval = (entry->value < 0) ? acs : entry->value; + *lval = val; *lval_changed = true; } } -- 2.35.3