From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: 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 Authentication-Results: sourceware.org; dmarc=pass (p=none dis=none) header.from=suse.de Authentication-Results: sourceware.org; spf=pass smtp.mailfrom=suse.de 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) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_rsa; t=1683555039; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc:cc: mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=SI3uMXZt+pwAVnsVuWxD41xy2O75vTFDrWxOxeiWv+I=; b=ej98Iy5LiVB0TrbifStQ/r8bXaEM2SFB/ByTuueT9LGUSCyR/zmsrLD0bs3mKcTIxScdfr fMCKuz/c8TQ1+jJrC+JfXRxo6xC+5jN4mZecZPUSbvv/etjJRQf9Sdn2axCRZkopAtc6Qw OpXTZyL3QkELngv0Op4Wbs1O6M42DY4= DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_ed25519; t=1683555039; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc:cc: mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=SI3uMXZt+pwAVnsVuWxD41xy2O75vTFDrWxOxeiWv+I=; b=SEDB1AzE4JfC2Q9FXAnIRggcGJZX78xRYwtIN6ozFWy98rWqfrzpQ4FMdElY7D1iDUX55Q ZpT+akQ+pGpoVtBg== 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 From: Tom de Vries 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-Spam-Status: No, score=-12.4 required=5.0 tests=BAYES_00,DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,GIT_PATCH_0,SPF_HELO_NONE,SPF_PASS,TXREP,T_SCC_BODY_TEXT_LINE autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on server2.sourceware.org List-Id: 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