From patchwork Sat Mar 25 15:18:15 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Masahiro Yamada X-Patchwork-Id: 74924 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a59:b0ea:0:b0:3b6:4342:cba0 with SMTP id b10csp467957vqo; Sat, 25 Mar 2023 08:20:51 -0700 (PDT) X-Google-Smtp-Source: AK7set9CXEn0VOJq96o3qaQ7HjGBRE6hMvJaM98/4no/nZEWYpaqxCIHNH468/o+doaFAFZelDEu X-Received: by 2002:a05:6a20:17aa:b0:d8:b2a8:f383 with SMTP id bl42-20020a056a2017aa00b000d8b2a8f383mr5495748pzb.53.1679757650863; Sat, 25 Mar 2023 08:20:50 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1679757650; cv=none; d=google.com; s=arc-20160816; b=rbMTatIWX0KHOkj2Qhl3+HFQKVwkZK71fYZLg3rWbeO1d9InAdx8OVPjtPspAKsRR8 rgMcymcJahfRfBrdtJ44w0MZR9B4OuDpNUTLJeMGRNH+iVBy3fpK/NoH9JZuWHJ/F/K3 ZgjwVwpG+PnJjZBgPVCMuMXAu4dv46JChYPhpcJ9X74vI6FA3qCudbVrC0LvbeF8Iqya bVSIsQ7VIm702Hld2Lk8IDJ/qKms3sRLDv214Fv2dHqMBAJM7tnKnnw5bNb3mO6nC7yX TCQ6nafuuJmcaZENsjSZaRFM/LwkcXrXmIb56hP10+wz+epdNFAUD9DklGSaJ2Kgp/wq 1bLg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :message-id:date:subject:cc:to:from:dkim-signature; bh=BOW4qBY0xgbpbBPkaKiDLgusVB3s2JpTj4wdpIgE7wA=; b=pZ5UdxVqaELhyJsBU6b1qnoSv5kaWC+yVPCFqu9LTNNhAGFlAAiBkskihaD5yTgERQ hKot8vJo8HHTBExStPEx1WWUd9vfxsFMi47h+BbpwWEf7z+UNUyeuAPyXcajkBWmfAZo iO3WqSoauazxVZrJss7m+elA2NQqiBWTrQ53crB5pkdwDYgUwceaLj/PQF+N8J16RST/ s8VKrJn9xe5PCMWFVVta4Z6O213i/KvBnm+dD9mpAxtiaU8kl5ld1IKnQ34Dx23Hm2/M 0JT5fLLzZQ0Tew9UQLH8iOfltv7iUGnRg/tUPKsR24V6d/U5efciX6gQAkL306tsydkk ioeg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=onmPrt8e; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id y6-20020a62f246000000b00628f842de7fsi9185866pfl.224.2023.03.25.08.20.38; Sat, 25 Mar 2023 08:20:50 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=onmPrt8e; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230265AbjCYPSa (ORCPT + 99 others); Sat, 25 Mar 2023 11:18:30 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:41000 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229446AbjCYPS2 (ORCPT ); Sat, 25 Mar 2023 11:18:28 -0400 Received: from ams.source.kernel.org (ams.source.kernel.org [145.40.68.75]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id B8D21EC53; Sat, 25 Mar 2023 08:18:26 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ams.source.kernel.org (Postfix) with ESMTPS id 2B75BB80522; Sat, 25 Mar 2023 15:18:25 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id D9732C433D2; Sat, 25 Mar 2023 15:18:22 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1679757503; bh=oo6E+Xz8WFT652hkrNiEygyhzHj1OHj9IRZztciFppk=; h=From:To:Cc:Subject:Date:From; b=onmPrt8ec/AGWTGDj9ryBF+U6FpJsvIcOREfG46slzOQOFZtIMETjQcG/SDa2q+dC MIyU1RhJ6yBtFUAe3dq4TvKIOj8lNuYq3BnG31smGU9IcmqwhzTApgwZ0sEsIaMq/s vQUcBRI3Cek6rzhdUsXNJZApWz5dg1T2gAC9RhrA9aNvmp7wex7aVD+/6VwS9KzCT1 WydeXFSqa8VwlonS3CCPyzkgi/knIXYq5HN812MkIj1JgypxXGokc+/YpjeVu3dWXV Wb4LdkuHo/PpWLTPfYQmQ3E4rFCJ7vaf/XccIS61GmGl6Ov+VZC2vSIMIqaI4t1q1B OzSC1FgonV0qg== From: Masahiro Yamada To: linux-kbuild@vger.kernel.org Cc: linux-kernel@vger.kernel.org, Masahiro Yamada Subject: [PATCH 1/3] kconfig: menuconfig: remove OLD_NCURSES macro Date: Sun, 26 Mar 2023 00:18:15 +0900 Message-Id: <20230325151817.2651544-1-masahiroy@kernel.org> X-Mailer: git-send-email 2.34.1 MIME-Version: 1.0 X-Spam-Status: No, score=-5.2 required=5.0 tests=DKIMWL_WL_HIGH,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_HI,SPF_HELO_NONE, SPF_PASS autolearn=unavailable autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1761353558098682924?= X-GMAIL-MSGID: =?utf-8?q?1761353558098682924?= This code has been here for more than 20 years. The bug in the old days no longer matters. Signed-off-by: Masahiro Yamada --- scripts/kconfig/lxdialog/dialog.h | 16 ---------------- scripts/kconfig/lxdialog/menubox.c | 8 -------- scripts/kconfig/lxdialog/textbox.c | 9 --------- 3 files changed, 33 deletions(-) diff --git a/scripts/kconfig/lxdialog/dialog.h b/scripts/kconfig/lxdialog/dialog.h index 68b565e3c495..bd2da3a928a7 100644 --- a/scripts/kconfig/lxdialog/dialog.h +++ b/scripts/kconfig/lxdialog/dialog.h @@ -18,22 +18,6 @@ #endif #include -/* - * Colors in ncurses 1.9.9e do not work properly since foreground and - * background colors are OR'd rather than separately masked. This version - * of dialog was hacked to work with ncurses 1.9.9e, making it incompatible - * with standard curses. The simplest fix (to make this work with standard - * curses) uses the wbkgdset() function, not used in the original hack. - * Turn it off if we're building with 1.9.9e, since it just confuses things. - */ -#if defined(NCURSES_VERSION) && defined(_NEED_WRAP) && !defined(GCC_PRINTFLIKE) -#define OLD_NCURSES 1 -#undef wbkgdset -#define wbkgdset(w,p) /*nothing */ -#else -#define OLD_NCURSES 0 -#endif - #define TR(params) _tracef params #define KEY_ESC 27 diff --git a/scripts/kconfig/lxdialog/menubox.c b/scripts/kconfig/lxdialog/menubox.c index 58c2f8afe59b..0e333284e947 100644 --- a/scripts/kconfig/lxdialog/menubox.c +++ b/scripts/kconfig/lxdialog/menubox.c @@ -63,15 +63,7 @@ static void do_print_item(WINDOW * win, const char *item, int line_y, /* Clear 'residue' of last item */ wattrset(win, dlg.menubox.atr); wmove(win, line_y, 0); -#if OLD_NCURSES - { - int i; - for (i = 0; i < menu_width; i++) - waddch(win, ' '); - } -#else wclrtoeol(win); -#endif wattrset(win, selected ? dlg.item_selected.atr : dlg.item.atr); mvwaddstr(win, line_y, item_x, menu_item); if (hotkey) { diff --git a/scripts/kconfig/lxdialog/textbox.c b/scripts/kconfig/lxdialog/textbox.c index 4e339b12664e..4a6ff9de45b9 100644 --- a/scripts/kconfig/lxdialog/textbox.c +++ b/scripts/kconfig/lxdialog/textbox.c @@ -336,16 +336,7 @@ static void print_line(WINDOW * win, int row, int width) waddnstr(win, line, MIN(strlen(line), width - 2)); /* Clear 'residue' of previous line */ -#if OLD_NCURSES - { - int x = getcurx(win); - int i; - for (i = 0; i < width - x; i++) - waddch(win, ' '); - } -#else wclrtoeol(win); -#endif } /* From patchwork Sat Mar 25 15:18:16 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Masahiro Yamada X-Patchwork-Id: 74926 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a59:b0ea:0:b0:3b6:4342:cba0 with SMTP id b10csp471257vqo; Sat, 25 Mar 2023 08:28:09 -0700 (PDT) X-Google-Smtp-Source: AKy350ZuYWJYtBnwhLx+0zyeEUsFr47o0ZF6bwmwAffB9OBB5bH+aTlA/Bdvxlk4LpKxZVHFZNXp X-Received: by 2002:aa7:952b:0:b0:627:e690:eacd with SMTP id c11-20020aa7952b000000b00627e690eacdmr5884689pfp.29.1679758089309; Sat, 25 Mar 2023 08:28:09 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1679758089; cv=none; d=google.com; s=arc-20160816; b=rJyzeeFD5gMRUk5vziuC3UzG7tRycoKws56uHpNLoIR9zSyracxfTKWxL/jhn8jgKX OC9UF9aSD7CvVa/63xQSMbW6zijurWSjymfi3qUNLoJ1l6NiHuczkACAKGM2vUSV8Hkp EldaSwKVDCuVodjDJuJRQXvu9QZtXBiy75JtF4Q0DjFUyma2pF4lwtbZqwHmiKML1mJV zMflb6q7ymOxEcDxw0Xrp+xEbPUT3YPyBZ/3/jBs+yMT2BvurozsH8QwUjdDAOdiFF6Y /BEls0l1YqdEuhfvJ5khNKugY6DnCvj0uLEnceU27yH0NmRL4q7vdLN/+MVMvu5tXjpv 8rzA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=Sro8fIN8xxV151U7mKKov0VEXrq7sTsz68AV/882OXg=; b=mq+dq6qDSA8YRDZ2YQsrU3rmvXn+Bz0u02+ExQd6BJOGJFQR2R7L7bvVRukaNh4gXI hXyAW3+nvMoA1NGwWOLO2/6tNF8f/JgKS7ELyi3RbCpKhvQm9ZBh4QtA48O4oqfUcrkf sR2Z72OX9UnUMOgrDyeq5cWenlILFAMbVvfalFVFCYGVsvoK/X2KhsbMHPdLoXK7Jdxa mRQqqhhjaZtcKQGcWC1WbQJBsPp6n7jBoky5cd0X5J3XCGNIPGpzSt7ulNceKLoUaK0f 37D392MMXV4D+HybLmDI8fSbguKjPXmOx5yIwyMnEdCttrQjdMVXBEd5pPL3CM5VfDvY XuXA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=HOLqNfQ9; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id l62-20020a638841000000b0050bf5143785si24394669pgd.836.2023.03.25.08.27.55; Sat, 25 Mar 2023 08:28:09 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=HOLqNfQ9; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231297AbjCYPSg (ORCPT + 99 others); Sat, 25 Mar 2023 11:18:36 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:41024 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229977AbjCYPS3 (ORCPT ); Sat, 25 Mar 2023 11:18:29 -0400 Received: from ams.source.kernel.org (ams.source.kernel.org [IPv6:2604:1380:4601:e00::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 116D4EFBC; Sat, 25 Mar 2023 08:18:27 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ams.source.kernel.org (Postfix) with ESMTPS id 7D18BB8069F; Sat, 25 Mar 2023 15:18:26 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 4AC28C4339B; Sat, 25 Mar 2023 15:18:24 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1679757505; bh=tkTD9Qnj5tYLcNVdDjFqSCc+FFZm5ICwkNKYESjvPsw=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=HOLqNfQ9egGUy2ohUakVYFVvreOhZDOQZYaMBXZcfSO1PPtTbDOLUT6A6zvkHc3CU mE/PZh3uK8Gwh4r9WNeHmAHVwipExlJ6udVHLvev8mG1+2+DBbEZTayYSyZt7JcD2q PbmRNwfZq0x5DNoxpcC+MkpEWY6c0nUsHb3RF8KmHy1Exp49syzfydhZdJf+CdPbHc X1Apl3mDGcXitE+thNEvdgJtgaGoMGY52oix+62lq15wYSB6YE4+vnx7PtOot0P+D5 7F/ZA/vp6QcZHDMIVTmqm3K3A/Fypt66u3TYXlIhRlFUYmQby15YDdhPz6keFRj0Ao Ng/tabBRYRgXw== From: Masahiro Yamada To: linux-kbuild@vger.kernel.org Cc: linux-kernel@vger.kernel.org, Masahiro Yamada Subject: [PATCH 2/3] kconfig: menuconfig: remove unused M_EVENT macro Date: Sun, 26 Mar 2023 00:18:16 +0900 Message-Id: <20230325151817.2651544-2-masahiroy@kernel.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20230325151817.2651544-1-masahiroy@kernel.org> References: <20230325151817.2651544-1-masahiroy@kernel.org> MIME-Version: 1.0 X-Spam-Status: No, score=-2.5 required=5.0 tests=DKIMWL_WL_HIGH,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_MED,SPF_HELO_NONE, SPF_PASS autolearn=unavailable autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1761354018324444008?= X-GMAIL-MSGID: =?utf-8?q?1761354018324444008?= This is not used anywhere. Signed-off-by: Masahiro Yamada --- scripts/kconfig/lxdialog/dialog.h | 11 ----------- 1 file changed, 11 deletions(-) diff --git a/scripts/kconfig/lxdialog/dialog.h b/scripts/kconfig/lxdialog/dialog.h index bd2da3a928a7..347daf25fdc8 100644 --- a/scripts/kconfig/lxdialog/dialog.h +++ b/scripts/kconfig/lxdialog/dialog.h @@ -209,14 +209,3 @@ int dialog_checklist(const char *title, const char *prompt, int height, int width, int list_height); int dialog_inputbox(const char *title, const char *prompt, int height, int width, const char *init); - -/* - * This is the base for fictitious keys, which activate - * the buttons. - * - * Mouse-generated keys are the following: - * -- the first 32 are used as numbers, in addition to '0'-'9' - * -- the lowercase are used to signal mouse-enter events (M_EVENT + 'o') - * -- uppercase chars are used to invoke the button (M_EVENT + 'O') - */ -#define M_EVENT (KEY_MAX+1) From patchwork Sat Mar 25 15:18:17 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Masahiro Yamada X-Patchwork-Id: 74925 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a59:b0ea:0:b0:3b6:4342:cba0 with SMTP id b10csp470496vqo; Sat, 25 Mar 2023 08:26:24 -0700 (PDT) X-Google-Smtp-Source: AKy350Zsx7RgVIeH2m41SyLa+DWsaktr9CmEim/Hl+uahWDY9v1BRBC71PXp8kdqwCRqB6yzk1tu X-Received: by 2002:a17:90a:1947:b0:23f:962e:825d with SMTP id 7-20020a17090a194700b0023f962e825dmr6219829pjh.1.1679757984230; Sat, 25 Mar 2023 08:26:24 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1679757984; cv=none; d=google.com; s=arc-20160816; b=KKiDXdKkf1RiO5BELWsoOgBfrZcVZoRldrFhcaQgsy5ujibiQYjHMy5XFUm32QTmDj KfRg92NjJDSpXnB7SfyLgWwoTSyJneNIsuT85yFgOT/GAoug/ePL+lvvQ1m+Fclb8IeE FXml21G4m6mP6y20FkqOOpVc06WpYoP99agmBL7ATqurQBDUAbYEz/4yshiXBMIBfNBQ Pe8CxBaBlAK/UEjo/uQ/AO2vU8M/PStSB+ZvZWCoJDtL/tvHXKaGJTr+Cw+WEkjlze9I eJ84duszOoSD+vX3dAl9JFTPrCwHGpmIcq1HrFBafBekRohOSLeAosLzxhovgpWHIg+7 oLJQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=myBQctEuMnFzrWHeIYhGSOk3u806dbRgueDy2VPYwMk=; b=ydDTOPw5lCJhLMlqBJtuuvnllDvk0zsj/K611CFw6STtV/kS6mVcI//gLVs4lit59z kVRPFfk95gG+nW6oWmo/FWqV6tRFBctYyDixWbuMfxmphYtpWXnLOYFqOkKT3Lu9KPRv L/hcaswWeHCXHWJBRO4wtX0nBOap5If6ogl5ZuGDUkCfXsddZVyUSr89evWgEBLgNw6O R7xrqqrXttyYA1vYw82Y21SacBjzCCMSUY6jXXAfttzExTaNAcydbcCu10EaRQ1TRaTB zO4fJpsc6lFlA4qhX/NU8AipeG3hNXdL1dRoSdlBV9kNWax5xboLi1o+UuxfMQjbTtn3 ALIg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=FBIumgan; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id l62-20020a638841000000b0050bf5143785si24394669pgd.836.2023.03.25.08.26.11; Sat, 25 Mar 2023 08:26:24 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=FBIumgan; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230522AbjCYPSd (ORCPT + 99 others); Sat, 25 Mar 2023 11:18:33 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:41014 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230062AbjCYPS3 (ORCPT ); Sat, 25 Mar 2023 11:18:29 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [139.178.84.217]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 8607FEC64; Sat, 25 Mar 2023 08:18:27 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id 1BD6B60C61; Sat, 25 Mar 2023 15:18:27 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 9B93CC433D2; Sat, 25 Mar 2023 15:18:25 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1679757506; bh=AskvAMkTh+EjFF8t4nxyKf0j06zonlQ6BxVR7L0hYoU=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=FBIumgan2CkwUd+7BSNElfUBVcn/rYKIlT8Rmt3lkqzPbi8qOzqSqXXdvufxyOLkE +GQHshCDugfIHdOtGWip1WRJEg+BjRZHbJ/RiZFOdM/anJpUk9W8pmvtzQKfFcOlM5 gJEADmHgbvvZ/CgL1R/l5EDcL+Fyk/PNMbRuAXqgVoHsV9idiS5YOh8OiicRjSiLuw eYPEwQqit5lvUVMVj4HmKnR3/4T3BIAcpKg4un/n54XVblk+YejzT6LNKCXroCfxnX TlnJHY2aVNVnDL7XQ/sePVCSeqMZeaYtHiIM2efxVrQOGiiSgORO2M+2WGz9YIYFeU r7fA1/J08WCyg== From: Masahiro Yamada To: linux-kbuild@vger.kernel.org Cc: linux-kernel@vger.kernel.org, Masahiro Yamada Subject: [PATCH 3/3] kconfig: menuconfig: reorder functions to remove forward declarations Date: Sun, 26 Mar 2023 00:18:17 +0900 Message-Id: <20230325151817.2651544-3-masahiroy@kernel.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20230325151817.2651544-1-masahiroy@kernel.org> References: <20230325151817.2651544-1-masahiroy@kernel.org> MIME-Version: 1.0 X-Spam-Status: No, score=-5.2 required=5.0 tests=DKIMWL_WL_HIGH,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_HI,SPF_HELO_NONE, SPF_PASS autolearn=unavailable autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1761353907913379382?= X-GMAIL-MSGID: =?utf-8?q?1761353907913379382?= Define helper functions before the callers so that forward declarations can go away. Signed-off-by: Masahiro Yamada --- scripts/kconfig/lxdialog/textbox.c | 258 ++++++++++++------------ scripts/kconfig/mconf.c | 314 ++++++++++++++--------------- 2 files changed, 277 insertions(+), 295 deletions(-) diff --git a/scripts/kconfig/lxdialog/textbox.c b/scripts/kconfig/lxdialog/textbox.c index 4a6ff9de45b9..bc4d4fb1dc75 100644 --- a/scripts/kconfig/lxdialog/textbox.c +++ b/scripts/kconfig/lxdialog/textbox.c @@ -8,18 +8,136 @@ #include "dialog.h" -static void back_lines(int n); -static void print_page(WINDOW *win, int height, int width, update_text_fn - update_text, void *data); -static void print_line(WINDOW *win, int row, int width); -static char *get_line(void); -static void print_position(WINDOW * win); - static int hscroll; static int begin_reached, end_reached, page_length; static char *buf; static char *page; +/* + * Go back 'n' lines in text. Called by dialog_textbox(). + * 'page' will be updated to point to the desired line in 'buf'. + */ +static void back_lines(int n) +{ + int i; + + begin_reached = 0; + /* Go back 'n' lines */ + for (i = 0; i < n; i++) { + if (*page == '\0') { + if (end_reached) { + end_reached = 0; + continue; + } + } + if (page == buf) { + begin_reached = 1; + return; + } + page--; + do { + if (page == buf) { + begin_reached = 1; + return; + } + page--; + } while (*page != '\n'); + page++; + } +} + +/* + * Return current line of text. Called by dialog_textbox() and print_line(). + * 'page' should point to start of current line before calling, and will be + * updated to point to start of next line. + */ +static char *get_line(void) +{ + int i = 0; + static char line[MAX_LEN + 1]; + + end_reached = 0; + while (*page != '\n') { + if (*page == '\0') { + end_reached = 1; + break; + } else if (i < MAX_LEN) + line[i++] = *(page++); + else { + /* Truncate lines longer than MAX_LEN characters */ + if (i == MAX_LEN) + line[i++] = '\0'; + page++; + } + } + if (i <= MAX_LEN) + line[i] = '\0'; + if (!end_reached) + page++; /* move past '\n' */ + + return line; +} + +/* + * Print a new line of text. + */ +static void print_line(WINDOW *win, int row, int width) +{ + char *line; + + line = get_line(); + line += MIN(strlen(line), hscroll); /* Scroll horizontally */ + wmove(win, row, 0); /* move cursor to correct line */ + waddch(win, ' '); + waddnstr(win, line, MIN(strlen(line), width - 2)); + + /* Clear 'residue' of previous line */ + wclrtoeol(win); +} + +/* + * Print a new page of text. + */ +static void print_page(WINDOW *win, int height, int width, update_text_fn + update_text, void *data) +{ + int i, passed_end = 0; + + if (update_text) { + char *end; + + for (i = 0; i < height; i++) + get_line(); + end = page; + back_lines(height); + update_text(buf, page - buf, end - buf, data); + } + + page_length = 0; + for (i = 0; i < height; i++) { + print_line(win, i, width); + if (!passed_end) + page_length++; + if (end_reached && !passed_end) + passed_end = 1; + } + wnoutrefresh(win); +} + +/* + * Print current position + */ +static void print_position(WINDOW *win) +{ + int percent; + + wattrset(win, dlg.position_indicator.atr); + wbkgdset(win, dlg.position_indicator.atr & A_COLOR); + percent = (page - buf) * 100 / strlen(buf); + wmove(win, getmaxy(win) - 3, getmaxx(win) - 9); + wprintw(win, "(%3d%%)", percent); +} + /* * refresh window content */ @@ -33,7 +151,6 @@ static void refresh_text_box(WINDOW *dialog, WINDOW *box, int boxh, int boxw, wrefresh(dialog); } - /* * Display text from a file in a dialog box. * @@ -259,128 +376,3 @@ int dialog_textbox(const char *title, char *tbuf, int initial_height, *_hscroll = hscroll; return key; } - -/* - * Go back 'n' lines in text. Called by dialog_textbox(). - * 'page' will be updated to point to the desired line in 'buf'. - */ -static void back_lines(int n) -{ - int i; - - begin_reached = 0; - /* Go back 'n' lines */ - for (i = 0; i < n; i++) { - if (*page == '\0') { - if (end_reached) { - end_reached = 0; - continue; - } - } - if (page == buf) { - begin_reached = 1; - return; - } - page--; - do { - if (page == buf) { - begin_reached = 1; - return; - } - page--; - } while (*page != '\n'); - page++; - } -} - -/* - * Print a new page of text. - */ -static void print_page(WINDOW *win, int height, int width, update_text_fn - update_text, void *data) -{ - int i, passed_end = 0; - - if (update_text) { - char *end; - - for (i = 0; i < height; i++) - get_line(); - end = page; - back_lines(height); - update_text(buf, page - buf, end - buf, data); - } - - page_length = 0; - for (i = 0; i < height; i++) { - print_line(win, i, width); - if (!passed_end) - page_length++; - if (end_reached && !passed_end) - passed_end = 1; - } - wnoutrefresh(win); -} - -/* - * Print a new line of text. - */ -static void print_line(WINDOW * win, int row, int width) -{ - char *line; - - line = get_line(); - line += MIN(strlen(line), hscroll); /* Scroll horizontally */ - wmove(win, row, 0); /* move cursor to correct line */ - waddch(win, ' '); - waddnstr(win, line, MIN(strlen(line), width - 2)); - - /* Clear 'residue' of previous line */ - wclrtoeol(win); -} - -/* - * Return current line of text. Called by dialog_textbox() and print_line(). - * 'page' should point to start of current line before calling, and will be - * updated to point to start of next line. - */ -static char *get_line(void) -{ - int i = 0; - static char line[MAX_LEN + 1]; - - end_reached = 0; - while (*page != '\n') { - if (*page == '\0') { - end_reached = 1; - break; - } else if (i < MAX_LEN) - line[i++] = *(page++); - else { - /* Truncate lines longer than MAX_LEN characters */ - if (i == MAX_LEN) - line[i++] = '\0'; - page++; - } - } - if (i <= MAX_LEN) - line[i] = '\0'; - if (!end_reached) - page++; /* move past '\n' */ - - return line; -} - -/* - * Print current position - */ -static void print_position(WINDOW * win) -{ - int percent; - - wattrset(win, dlg.position_indicator.atr); - wbkgdset(win, dlg.position_indicator.atr & A_COLOR); - percent = (page - buf) * 100 / strlen(buf); - wmove(win, getmaxy(win) - 3, getmaxx(win) - 9); - wprintw(win, "(%3d%%)", percent); -} diff --git a/scripts/kconfig/mconf.c b/scripts/kconfig/mconf.c index e67e0db50b2e..53d8834d12fe 100644 --- a/scripts/kconfig/mconf.c +++ b/scripts/kconfig/mconf.c @@ -290,16 +290,6 @@ static int save_and_exit; static int silent; static void conf(struct menu *menu, struct menu *active_menu); -static void conf_choice(struct menu *menu); -static void conf_string(struct menu *menu); -static void conf_load(void); -static void conf_save(void); -static int show_textbox_ext(const char *title, char *text, int r, int c, - int *keys, int *vscroll, int *hscroll, - update_text_fn update_text, void *data); -static void show_textbox(const char *title, const char *text, int r, int c); -static void show_helptext(const char *title, const char *text); -static void show_help(struct menu *menu); static char filename[PATH_MAX+1]; static void set_config_filename(const char *config_filename) @@ -358,6 +348,37 @@ static void reset_subtitle(void) set_dialog_subtitles(subtitles); } +static int show_textbox_ext(const char *title, char *text, int r, int c, int + *keys, int *vscroll, int *hscroll, update_text_fn + update_text, void *data) +{ + dialog_clear(); + return dialog_textbox(title, text, r, c, keys, vscroll, hscroll, + update_text, data); +} + +static void show_textbox(const char *title, const char *text, int r, int c) +{ + show_textbox_ext(title, (char *) text, r, c, (int []) {0}, NULL, NULL, + NULL, NULL); +} + +static void show_helptext(const char *title, const char *text) +{ + show_textbox(title, text, 0, 0); +} + +static void show_help(struct menu *menu) +{ + struct gstr help = str_new(); + + help.max_width = getmaxx(stdscr) - 10; + menu_get_ext_help(menu, &help); + + show_helptext(menu_get_prompt(menu), str_get(&help)); + str_free(&help); +} + struct search_data { struct list_head *head; struct menu **targets; @@ -643,158 +664,6 @@ static void build_conf(struct menu *menu) indent -= doint; } -static void conf(struct menu *menu, struct menu *active_menu) -{ - struct menu *submenu; - const char *prompt = menu_get_prompt(menu); - struct subtitle_part stpart; - struct symbol *sym; - int res; - int s_scroll = 0; - - if (menu != &rootmenu) - stpart.text = menu_get_prompt(menu); - else - stpart.text = NULL; - list_add_tail(&stpart.entries, &trail); - - while (1) { - item_reset(); - current_menu = menu; - build_conf(menu); - if (!child_count) - break; - set_subtitle(); - dialog_clear(); - res = dialog_menu(prompt ? prompt : "Main Menu", - menu_instructions, - active_menu, &s_scroll); - if (res == 1 || res == KEY_ESC || res == -ERRDISPLAYTOOSMALL) - break; - if (item_count() != 0) { - if (!item_activate_selected()) - continue; - if (!item_tag()) - continue; - } - submenu = item_data(); - active_menu = item_data(); - if (submenu) - sym = submenu->sym; - else - sym = NULL; - - switch (res) { - case 0: - switch (item_tag()) { - case 'm': - if (single_menu_mode) - submenu->data = (void *) (long) !submenu->data; - else - conf(submenu, NULL); - break; - case 't': - if (sym_is_choice(sym) && sym_get_tristate_value(sym) == yes) - conf_choice(submenu); - else if (submenu->prompt->type == P_MENU) - conf(submenu, NULL); - break; - case 's': - conf_string(submenu); - break; - } - break; - case 2: - if (sym) - show_help(submenu); - else { - reset_subtitle(); - show_helptext("README", mconf_readme); - } - break; - case 3: - reset_subtitle(); - conf_save(); - break; - case 4: - reset_subtitle(); - conf_load(); - break; - case 5: - if (item_is_tag('t')) { - if (sym_set_tristate_value(sym, yes)) - break; - if (sym_set_tristate_value(sym, mod)) - show_textbox(NULL, setmod_text, 6, 74); - } - break; - case 6: - if (item_is_tag('t')) - sym_set_tristate_value(sym, no); - break; - case 7: - if (item_is_tag('t')) - sym_set_tristate_value(sym, mod); - break; - case 8: - if (item_is_tag('t')) - sym_toggle_tristate_value(sym); - else if (item_is_tag('m')) - conf(submenu, NULL); - break; - case 9: - search_conf(); - break; - case 10: - show_all_options = !show_all_options; - break; - } - } - - list_del(trail.prev); -} - -static int show_textbox_ext(const char *title, char *text, int r, int c, int - *keys, int *vscroll, int *hscroll, update_text_fn - update_text, void *data) -{ - dialog_clear(); - return dialog_textbox(title, text, r, c, keys, vscroll, hscroll, - update_text, data); -} - -static void show_textbox(const char *title, const char *text, int r, int c) -{ - show_textbox_ext(title, (char *) text, r, c, (int []) {0}, NULL, NULL, - NULL, NULL); -} - -static void show_helptext(const char *title, const char *text) -{ - show_textbox(title, text, 0, 0); -} - -static void conf_message_callback(const char *s) -{ - if (save_and_exit) { - if (!silent) - printf("%s", s); - } else { - show_textbox(NULL, s, 6, 60); - } -} - -static void show_help(struct menu *menu) -{ - struct gstr help = str_new(); - - help.max_width = getmaxx(stdscr) - 10; - menu_get_ext_help(menu, &help); - - show_helptext(menu_get_prompt(menu), str_get(&help)); - str_free(&help); -} - static void conf_choice(struct menu *menu) { const char *prompt = menu_get_prompt(menu); @@ -950,6 +819,127 @@ static void conf_save(void) } } +static void conf(struct menu *menu, struct menu *active_menu) +{ + struct menu *submenu; + const char *prompt = menu_get_prompt(menu); + struct subtitle_part stpart; + struct symbol *sym; + int res; + int s_scroll = 0; + + if (menu != &rootmenu) + stpart.text = menu_get_prompt(menu); + else + stpart.text = NULL; + list_add_tail(&stpart.entries, &trail); + + while (1) { + item_reset(); + current_menu = menu; + build_conf(menu); + if (!child_count) + break; + set_subtitle(); + dialog_clear(); + res = dialog_menu(prompt ? prompt : "Main Menu", + menu_instructions, + active_menu, &s_scroll); + if (res == 1 || res == KEY_ESC || res == -ERRDISPLAYTOOSMALL) + break; + if (item_count() != 0) { + if (!item_activate_selected()) + continue; + if (!item_tag()) + continue; + } + submenu = item_data(); + active_menu = item_data(); + if (submenu) + sym = submenu->sym; + else + sym = NULL; + + switch (res) { + case 0: + switch (item_tag()) { + case 'm': + if (single_menu_mode) + submenu->data = (void *) (long) !submenu->data; + else + conf(submenu, NULL); + break; + case 't': + if (sym_is_choice(sym) && sym_get_tristate_value(sym) == yes) + conf_choice(submenu); + else if (submenu->prompt->type == P_MENU) + conf(submenu, NULL); + break; + case 's': + conf_string(submenu); + break; + } + break; + case 2: + if (sym) + show_help(submenu); + else { + reset_subtitle(); + show_helptext("README", mconf_readme); + } + break; + case 3: + reset_subtitle(); + conf_save(); + break; + case 4: + reset_subtitle(); + conf_load(); + break; + case 5: + if (item_is_tag('t')) { + if (sym_set_tristate_value(sym, yes)) + break; + if (sym_set_tristate_value(sym, mod)) + show_textbox(NULL, setmod_text, 6, 74); + } + break; + case 6: + if (item_is_tag('t')) + sym_set_tristate_value(sym, no); + break; + case 7: + if (item_is_tag('t')) + sym_set_tristate_value(sym, mod); + break; + case 8: + if (item_is_tag('t')) + sym_toggle_tristate_value(sym); + else if (item_is_tag('m')) + conf(submenu, NULL); + break; + case 9: + search_conf(); + break; + case 10: + show_all_options = !show_all_options; + break; + } + } + + list_del(trail.prev); +} + +static void conf_message_callback(const char *s) +{ + if (save_and_exit) { + if (!silent) + printf("%s", s); + } else { + show_textbox(NULL, s, 6, 60); + } +} + static int handle_exit(void) { int res;