public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: Masahiro Yamada <masahiroy@kernel.org>
To: linux-kbuild@vger.kernel.org
Cc: linux-kernel@vger.kernel.org,
	Jesse Taube <Mr.Bossman075@gmail.com>,
	Masahiro Yamada <masahiroy@kernel.org>
Subject: [PATCH 2/2] kconfig: menuconfig: remove jump_key::index
Date: Fri, 30 Jun 2023 01:03:51 +0900	[thread overview]
Message-ID: <20230629160351.2996541-2-masahiroy@kernel.org> (raw)
In-Reply-To: <20230629160351.2996541-1-masahiroy@kernel.org>

You do not need to remember the index of each jump key because you can
count it up after a key is pressed.

Signed-off-by: Masahiro Yamada <masahiroy@kernel.org>
---

 scripts/kconfig/expr.h  | 1 -
 scripts/kconfig/mconf.c | 7 ++++---
 scripts/kconfig/menu.c  | 8 --------
 3 files changed, 4 insertions(+), 12 deletions(-)

diff --git a/scripts/kconfig/expr.h b/scripts/kconfig/expr.h
index 9c9caca5bd5f..4a9a23b1b7e1 100644
--- a/scripts/kconfig/expr.h
+++ b/scripts/kconfig/expr.h
@@ -275,7 +275,6 @@ struct jump_key {
 	struct list_head entries;
 	size_t offset;
 	struct menu *target;
-	int index;
 };
 
 extern struct file *file_list;
diff --git a/scripts/kconfig/mconf.c b/scripts/kconfig/mconf.c
index 7adfd6537279..fcb91d69c774 100644
--- a/scripts/kconfig/mconf.c
+++ b/scripts/kconfig/mconf.c
@@ -22,8 +22,6 @@
 #include "lkc.h"
 #include "lxdialog/dialog.h"
 
-#define JUMP_NB			9
-
 static const char mconf_readme[] =
 "Overview\n"
 "--------\n"
@@ -399,6 +397,7 @@ static int handle_search_keys(int key, int start, int end, void *_data)
 {
 	struct search_data *data = _data;
 	struct jump_key *pos;
+	int index = '1';
 
 	if (key < '1' || key > '9')
 		return 0;
@@ -408,11 +407,13 @@ static int handle_search_keys(int key, int start, int end, void *_data)
 			if (pos->offset >= end)
 				break;
 
-			if (key == '1' + (pos->index % JUMP_NB)) {
+			if (key == index) {
 				data->target = pos->target;
 				return 1;
 			}
 		}
+
+		index = next_key(index);
 	}
 
 	return 0;
diff --git a/scripts/kconfig/menu.c b/scripts/kconfig/menu.c
index 5578b8bc8a23..198eb1367e7a 100644
--- a/scripts/kconfig/menu.c
+++ b/scripts/kconfig/menu.c
@@ -735,15 +735,7 @@ static void get_prompt_str(struct gstr *r, struct property *prop,
 	}
 	if (head && location) {
 		jump = xmalloc(sizeof(struct jump_key));
-
 		jump->target = location;
-
-		if (list_empty(head))
-			jump->index = 0;
-		else
-			jump->index = list_entry(head->prev, struct jump_key,
-						 entries)->index + 1;
-
 		list_add_tail(&jump->entries, head);
 	}
 
-- 
2.39.2


  reply	other threads:[~2023-06-29 16:04 UTC|newest]

Thread overview: 12+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-06-29 16:03 [PATCH 1/2] kconfig: menuconfig: simplify global jump key assignment Masahiro Yamada
2023-06-29 16:03 ` Masahiro Yamada [this message]
2023-07-01  4:08   ` [PATCH 2/2] kconfig: menuconfig: remove jump_key::index Jesse T
2023-07-01  4:23     ` Randy Dunlap
2023-07-01  4:38       ` Jesse T
2023-07-01  4:43         ` Randy Dunlap
2023-07-02 15:27     ` Masahiro Yamada
2023-07-01  3:57 ` [PATCH 1/2] kconfig: menuconfig: simplify global jump key assignment Jesse T
2023-07-02 15:09   ` Masahiro Yamada
2023-07-02 19:32 ` Jesse T
2023-07-02 20:26   ` Jesse T
2023-07-12 17:39     ` Jesse T

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20230629160351.2996541-2-masahiroy@kernel.org \
    --to=masahiroy@kernel.org \
    --cc=Mr.Bossman075@gmail.com \
    --cc=linux-kbuild@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox