From patchwork Wed Oct 23 06:29:31 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Rolf Eike Beer X-Patchwork-Id: 13846542 Received: from mx1.emlix.com (mx1.emlix.com [178.63.209.131]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 38AF013BC11; Wed, 23 Oct 2024 06:38:41 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=178.63.209.131 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1729665525; cv=none; b=I3MV+JZcMLObcL4mwgavcx0IQFOKFs8kgHCTyso8Ec/DJvnBMMwA/F+uezUKD1N6mNMrEyvGQmoWqOuTOObVpaxgfVvdCMV9MK5Oo0b/rZMD7lGX/1dLpkbc6GNzyBpq5+ADQDCpybCnC2+9o3r50CKLBT06VmZOb1QIuEdoZ2U= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1729665525; c=relaxed/simple; bh=FkbXTX6/laHtcxuSP/YuZ0C5lTynxiJsq6LDdjhZNnQ=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version:Content-Type; b=c0vlWydoFa+MWuMqPRsPfMtp4KIASEYXYjmKnZtIviz/GiVISRssPG8zVURk2cJjr8+WPk4KiN6JDzmQXVE1ksLvU20MlQORASVXDFYonAPYfXv4f+AIdwfeP5QbHz25UTcOPhViJ5VfRkQGzdYV0IThBNiBL+N7NhSTZwg0poU= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=emlix.com; spf=pass smtp.mailfrom=emlix.com; arc=none smtp.client-ip=178.63.209.131 Authentication-Results: smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=emlix.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=emlix.com Received: from mailer.emlix.com (p5098be52.dip0.t-ipconnect.de [80.152.190.82]) (using TLSv1.2 with cipher ADH-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mx1.emlix.com (Postfix) with ESMTPS id 2BDA25F8A7; Wed, 23 Oct 2024 08:29:32 +0200 (CEST) From: Rolf Eike Beer To: Masahiro Yamada Cc: linux-kbuild@vger.kernel.org, linux-kernel@vger.kernel.org Subject: [PATCH 1/7] kconfig: qconf: use QByteArray API instead of manually constructing a string Date: Wed, 23 Oct 2024 08:29:31 +0200 Message-ID: <4931941.GXAFRqVoOG@devpool47.emlix.com> Organization: emlix GmbH In-Reply-To: <4960180.31r3eYUQgx@devpool47.emlix.com> References: <4960180.31r3eYUQgx@devpool47.emlix.com> Precedence: bulk X-Mailing-List: linux-kbuild@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Using a naked char[] here isn't necessary as QByteArray has a nice API for all of this. Calling constData() will also always return a 0-terminated string so no further handling is required. And then the whole manual memory handling can go away as QByteArray will care for this when it goes out of scope. Signed-off-by: Rolf Eike Beer --- scripts/kconfig/qconf.cc | 17 ++++------------- 1 file changed, 4 insertions(+), 13 deletions(-) diff --git a/scripts/kconfig/qconf.cc b/scripts/kconfig/qconf.cc index e260cab1c2af..742ca6ed289b 100644 --- a/scripts/kconfig/qconf.cc +++ b/scripts/kconfig/qconf.cc @@ -1165,25 +1165,17 @@ void ConfigInfoView::expr_print_help(void *data, struct symbol *sym, const char void ConfigInfoView::clicked(const QUrl &url) { QByteArray str = url.toEncoded(); - const std::size_t count = str.size(); - char *data = new char[count + 2]; // '$' + '\0' struct symbol **result; struct menu *m = NULL; - if (count < 1) { - delete[] data; + if (str.isEmpty()) return; - } - - memcpy(data, str.constData(), count); - data[count] = '\0'; /* Seek for exact match */ - data[0] = '^'; - strcat(data, "$"); - result = sym_re_search(data); + str[0] = '^'; + str.append('$'); + result = sym_re_search(str.constData()); if (!result) { - delete[] data; return; } @@ -1206,7 +1198,6 @@ void ConfigInfoView::clicked(const QUrl &url) } free(result); - delete[] data; } void ConfigInfoView::contextMenuEvent(QContextMenuEvent *event) From patchwork Wed Oct 23 06:31:46 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Rolf Eike Beer X-Patchwork-Id: 13846528 Received: from mx1.emlix.com (mx1.emlix.com [178.63.209.131]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 60EAC13A3F3; Wed, 23 Oct 2024 06:31:49 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=178.63.209.131 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1729665112; cv=none; b=S87WenzR86HESvNZZ+zC9WOYjGoAuEbKTljiJbBvG0PH7V7dVtBYtmZaz7Uw0VroDAEFfvu6M236IOVSGXnBUlI3+2CnbzTs895E60uol0hmcrhcu8aWfxxhnpMBzV5XvKAtamBnZK/Ti9xei9GLKN3oxbdQTR86snks36ht55A= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1729665112; c=relaxed/simple; bh=us+grQV/jXWmtQNBUfunsLR1+H2Rv7P8p/uyZMzN51U=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version:Content-Type; b=bUzZDAnF9bJ1pTsS9sDo51fsNeIJtKZhi5P10zq3f09tWgq2kSovF4mrlxUYcxpt7GySBM9AM4yDly6CcL0hMiM7SlzqbLU8nclU/kV+MnnCxoR1n9WFfWx+2KRQffkQ+ocsWQfkV4InrYVFs+2Cluiptn5/yZWItjrx7xdh/eI= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=emlix.com; spf=pass smtp.mailfrom=emlix.com; arc=none smtp.client-ip=178.63.209.131 Authentication-Results: smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=emlix.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=emlix.com Received: from mailer.emlix.com (p5098be52.dip0.t-ipconnect.de [80.152.190.82]) (using TLSv1.2 with cipher ADH-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mx1.emlix.com (Postfix) with ESMTPS id 2A52D5FAFA; Wed, 23 Oct 2024 08:31:47 +0200 (CEST) From: Rolf Eike Beer To: Masahiro Yamada Cc: linux-kbuild@vger.kernel.org, linux-kernel@vger.kernel.org Subject: [PATCH 2/7] kconfig: qconf: use QString to store path to configuration file Date: Wed, 23 Oct 2024 08:31:46 +0200 Message-ID: <13623531.uLZWGnKmhe@devpool47.emlix.com> Organization: emlix GmbH In-Reply-To: <4960180.31r3eYUQgx@devpool47.emlix.com> References: <4960180.31r3eYUQgx@devpool47.emlix.com> Precedence: bulk X-Mailing-List: linux-kbuild@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 This is the native type used by the file dialogs and avoids any hassle with filename encoding when converting this back and forth to a character array. Signed-off-by: Rolf Eike Beer --- scripts/kconfig/qconf.cc | 24 ++++++------------------ scripts/kconfig/qconf.h | 2 +- 2 files changed, 7 insertions(+), 19 deletions(-) diff --git a/scripts/kconfig/qconf.cc b/scripts/kconfig/qconf.cc index 742ca6ed289b..54640f6b29e2 100644 --- a/scripts/kconfig/qconf.cc +++ b/scripts/kconfig/qconf.cc @@ -1380,7 +1380,7 @@ ConfigMainWindow::ConfigMainWindow(void) conf_set_changed_callback(conf_changed); - configname = xstrdup(conf_get_configname()); + configname = conf_get_configname(); QAction *saveAsAction = new QAction("Save &As...", this); connect(saveAsAction, &QAction::triggered, @@ -1519,28 +1519,22 @@ ConfigMainWindow::ConfigMainWindow(void) void ConfigMainWindow::loadConfig(void) { QString str; - QByteArray ba; - const char *name; str = QFileDialog::getOpenFileName(this, "", configname); if (str.isNull()) return; - ba = str.toLocal8Bit(); - name = ba.data(); - - if (conf_read(name)) + if (conf_read(str.toLocal8Bit().constData())) QMessageBox::information(this, "qconf", "Unable to load configuration!"); - free(configname); - configname = xstrdup(name); + configname = str; ConfigList::updateListAllForAll(); } bool ConfigMainWindow::saveConfig(void) { - if (conf_write(configname)) { + if (conf_write(configname.toLocal8Bit().constData())) { QMessageBox::information(this, "qconf", "Unable to save configuration!"); return false; } @@ -1552,23 +1546,17 @@ bool ConfigMainWindow::saveConfig(void) void ConfigMainWindow::saveConfigAs(void) { QString str; - QByteArray ba; - const char *name; str = QFileDialog::getSaveFileName(this, "", configname); if (str.isNull()) return; - ba = str.toLocal8Bit(); - name = ba.data(); - - if (conf_write(name)) { + if (conf_write(str.toLocal8Bit().constData())) { QMessageBox::information(this, "qconf", "Unable to save configuration!"); } conf_write_autoconf(0); - free(configname); - configname = xstrdup(name); + configname = str; } void ConfigMainWindow::searchConfig(void) diff --git a/scripts/kconfig/qconf.h b/scripts/kconfig/qconf.h index 53373064d90a..aab25ece95c6 100644 --- a/scripts/kconfig/qconf.h +++ b/scripts/kconfig/qconf.h @@ -237,7 +237,7 @@ public slots: class ConfigMainWindow : public QMainWindow { Q_OBJECT - char *configname; + QString configname; static QAction *saveAction; static void conf_changed(bool); public: From patchwork Wed Oct 23 06:32:41 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Rolf Eike Beer X-Patchwork-Id: 13846537 Received: from mx1.emlix.com (mx1.emlix.com [178.63.209.131]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id C6A30D27E; Wed, 23 Oct 2024 06:32:43 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=178.63.209.131 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1729665166; cv=none; b=u2JWaptfj/TCMhD7zZhLBQL1kkY9NMjyXJWsoxTBMruMWQ47kpoJXBdan/PrXi19NnZCx9BaMigACrSArpdd9my+OozHyuvcWguArpeFQ3FsXFT4XmzUFC+Hvf3fHjkFVdh4XEN9K7TTkV2LTvn2nat0FZkWHi0A3Ov/072T+Rs= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1729665166; c=relaxed/simple; bh=KxVhKLvtOGfGOFZI1MpAkIzF3UjApMVOZOZ5t2N++rA=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version:Content-Type; b=SXi9rVt/5i77MQSuyOXuq7HlDJmNAVhQHt3ORDSxV46u55EhQEcFQkeR/yL1A1CsGXWAqHgp4ujJBGcbGQ+RZralPErc9RCUHVNiNWf61zBJGI52WWj+Tg6FKiEIgwBTXvLatgwiG9xNtoEWfL0iuN++9Ol4lW+UpYfjoBMJ0zk= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=emlix.com; spf=pass smtp.mailfrom=emlix.com; arc=none smtp.client-ip=178.63.209.131 Authentication-Results: smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=emlix.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=emlix.com Received: from mailer.emlix.com (p5098be52.dip0.t-ipconnect.de [80.152.190.82]) (using TLSv1.2 with cipher ADH-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mx1.emlix.com (Postfix) with ESMTPS id 1796D5F976; Wed, 23 Oct 2024 08:32:42 +0200 (CEST) From: Rolf Eike Beer To: Masahiro Yamada Cc: linux-kbuild@vger.kernel.org, linux-kernel@vger.kernel.org Subject: [PATCH 3/7] kconfig: qconf: use preferred form of QString API Date: Wed, 23 Oct 2024 08:32:41 +0200 Message-ID: <3317655.aeNJFYEL58@devpool47.emlix.com> Organization: emlix GmbH In-Reply-To: <4960180.31r3eYUQgx@devpool47.emlix.com> References: <4960180.31r3eYUQgx@devpool47.emlix.com> Precedence: bulk X-Mailing-List: linux-kbuild@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Signed-off-by: Rolf Eike Beer --- scripts/kconfig/qconf.cc | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/scripts/kconfig/qconf.cc b/scripts/kconfig/qconf.cc index 54640f6b29e2..6a653ebe9df3 100644 --- a/scripts/kconfig/qconf.cc +++ b/scripts/kconfig/qconf.cc @@ -1520,8 +1520,8 @@ void ConfigMainWindow::loadConfig(void) { QString str; - str = QFileDialog::getOpenFileName(this, "", configname); - if (str.isNull()) + str = QFileDialog::getOpenFileName(this, QString(), configname); + if (str.isEmpty()) return; if (conf_read(str.toLocal8Bit().constData())) @@ -1547,8 +1547,8 @@ void ConfigMainWindow::saveConfigAs(void) { QString str; - str = QFileDialog::getSaveFileName(this, "", configname); - if (str.isNull()) + str = QFileDialog::getSaveFileName(this, QString(), configname); + if (str.isEmpty()) return; if (conf_write(str.toLocal8Bit().constData())) { From patchwork Wed Oct 23 06:33:26 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Rolf Eike Beer X-Patchwork-Id: 13846538 Received: from mx1.emlix.com (mx1.emlix.com [178.63.209.131]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id D6AEA149011; Wed, 23 Oct 2024 06:33:28 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=178.63.209.131 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1729665211; cv=none; b=MTGarDQ5+lk3bOE5UIjsIoJc5cOvbgyfILoLiGI9KCxEewgl6oNGZwZDaSE89Wp25or+jKxQd3qS6h7+bvQ+Y/Ud8tNkg0IdMumQfBFIZeMkwPIskZsYgDMcbXsGttKEser9tRxV9EvzR33pIRt8d4GMlGLZUlzRgICx8aSzax0= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1729665211; c=relaxed/simple; bh=tL9WB59hfAXSN94hpAXwy9dgVG30yl1q1MSVzRi6vjk=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version:Content-Type; b=sZ+LAIAxkPO2Ti/kwS35VS1lohCnU0eD2U+OyN8RmjdXNp/2xihfQi/oYh/HtSlc4rwKuAsG0+Vcx48OOFLBmigmjUw/6l+n0VHt5kVXe1gEBCEecWPgdY9MXvg5kmx0t390rRxprxZwQCrVE24U+nvyMqNP0hSMRbCQSdqJY2s= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=emlix.com; spf=pass smtp.mailfrom=emlix.com; arc=none smtp.client-ip=178.63.209.131 Authentication-Results: smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=emlix.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=emlix.com Received: from mailer.emlix.com (p5098be52.dip0.t-ipconnect.de [80.152.190.82]) (using TLSv1.2 with cipher ADH-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mx1.emlix.com (Postfix) with ESMTPS id EE8375F976; Wed, 23 Oct 2024 08:33:26 +0200 (CEST) From: Rolf Eike Beer To: Masahiro Yamada Cc: linux-kbuild@vger.kernel.org, linux-kernel@vger.kernel.org Subject: [PATCH 4/7] kconfig: qconf: use QCommandLineParser Date: Wed, 23 Oct 2024 08:33:26 +0200 Message-ID: <8441512.T7Z3S40VBb@devpool47.emlix.com> Organization: emlix GmbH In-Reply-To: <4960180.31r3eYUQgx@devpool47.emlix.com> References: <4960180.31r3eYUQgx@devpool47.emlix.com> Precedence: bulk X-Mailing-List: linux-kbuild@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 This has a much nicer output without manual processing. It also adds window management options from Qt for free. Signed-off-by: Rolf Eike Beer --- scripts/kconfig/qconf.cc | 44 ++++++++++++++++------------------------ 1 file changed, 17 insertions(+), 27 deletions(-) diff --git a/scripts/kconfig/qconf.cc b/scripts/kconfig/qconf.cc index 6a653ebe9df3..313a51941825 100644 --- a/scripts/kconfig/qconf.cc +++ b/scripts/kconfig/qconf.cc @@ -8,6 +8,7 @@ #include #include #include +#include #include #include #include @@ -1844,41 +1845,30 @@ void fixup_rootmenu(struct menu *menu) } } -static const char *progname; - -static void usage(void) -{ - printf("%s [-s] \n", progname); - exit(0); -} - int main(int ac, char** av) { ConfigMainWindow* v; - const char *name; + configApp = new QApplication(ac, av); + QCommandLineParser cmdline; + QCommandLineOption silent("s", "silent"); - progname = av[0]; - if (ac > 1 && av[1][0] == '-') { - switch (av[1][1]) { - case 's': - conf_set_message_callback(NULL); - break; - case 'h': - case '?': - usage(); - } - name = av[2]; - } else - name = av[1]; - if (!name) - usage(); + cmdline.addOption(silent); + cmdline.addHelpOption(); + cmdline.addPositionalArgument("file", "config file to open", "Kconfig"); + + cmdline.process(*configApp); + + if (cmdline.isSet(silent)) + conf_set_message_callback(NULL); - conf_parse(name); + QStringList args = cmdline.positionalArguments(); + if (args.isEmpty()) + cmdline.showHelp(1); + + conf_parse(args.first().toLocal8Bit().constData()); fixup_rootmenu(&rootmenu); //zconfdump(stdout); - configApp = new QApplication(ac, av); - configSettings = new ConfigSettings(); configSettings->beginGroup("/kconfig/qconf"); v = new ConfigMainWindow(); From patchwork Wed Oct 23 06:34:59 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Rolf Eike Beer X-Patchwork-Id: 13846539 Received: from mx1.emlix.com (mx1.emlix.com [178.63.209.131]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id A4C8C1482FE; Wed, 23 Oct 2024 06:35:01 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=178.63.209.131 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1729665304; cv=none; b=hJK0xhGo2B7Rfm7Jytb2nW67vwffiOQxIGrH9ZeehVl4uh2AZlgoVye2fJ2rnwksFgeHxapZ7HJyiB8YLbcx5o0VEif9KJZvZ1KtlFhZDtOADSfdvoENnZLsoWL9infx9+XrnAK6qcei+N1UXZ09YlB9ppwsxoFe/lHqCUcXXFU= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1729665304; c=relaxed/simple; bh=bPodnt7kOTWdoEdsKJvlV/U3rTazFyVpHEg6UqOCL9U=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version:Content-Type; b=MMo2WM/sl7+hot5AEJ3T4JsduYnSDauUFbu9gijziTW2ROVqVD54p3r+mE0kMsIklV+SQlmI35f6+F8QpQf7fZpzdbQnZaQEziChEJH4PMwaP98JgAW5G2gdrqmyN7bVDNHgJuagNZJLKE0odruwroPoAFgK53C4iZv+QNG5X9Q= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=emlix.com; spf=pass smtp.mailfrom=emlix.com; arc=none smtp.client-ip=178.63.209.131 Authentication-Results: smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=emlix.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=emlix.com Received: from mailer.emlix.com (p5098be52.dip0.t-ipconnect.de [80.152.190.82]) (using TLSv1.2 with cipher ADH-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mx1.emlix.com (Postfix) with ESMTPS id 907945F976; Wed, 23 Oct 2024 08:34:59 +0200 (CEST) From: Rolf Eike Beer To: Masahiro Yamada Cc: linux-kbuild@vger.kernel.org, linux-kernel@vger.kernel.org Subject: [PATCH 5/7] kconfig: qconf: use nullptr in C++11 code Date: Wed, 23 Oct 2024 08:34:59 +0200 Message-ID: <2286001.iZASKD2KPV@devpool47.emlix.com> Organization: emlix GmbH In-Reply-To: <4960180.31r3eYUQgx@devpool47.emlix.com> References: <4960180.31r3eYUQgx@devpool47.emlix.com> Precedence: bulk X-Mailing-List: linux-kbuild@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 This is type safe as it can't be accidentially assigned to something not a pointer. Signed-off-by: Rolf Eike Beer --- scripts/kconfig/qconf.cc | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/scripts/kconfig/qconf.cc b/scripts/kconfig/qconf.cc index 313a51941825..563ef8543d7c 100644 --- a/scripts/kconfig/qconf.cc +++ b/scripts/kconfig/qconf.cc @@ -874,7 +874,7 @@ skip: void ConfigList::focusInEvent(QFocusEvent *e) { - struct menu *menu = NULL; + struct menu *menu = nullptr; Parent::focusInEvent(e); @@ -933,7 +933,7 @@ void ConfigList::setAllOpen(bool open) } ConfigInfoView::ConfigInfoView(QWidget* parent, const char *name) - : Parent(parent), sym(0), _menu(0) + : Parent(parent), sym(nullptr), _menu(nullptr) { setObjectName(name); setOpenLinks(false); @@ -985,7 +985,7 @@ void ConfigInfoView::setInfo(struct menu *m) if (_menu == m) return; _menu = m; - sym = NULL; + sym = nullptr; if (!_menu) clear(); else @@ -1167,7 +1167,7 @@ void ConfigInfoView::clicked(const QUrl &url) { QByteArray str = url.toEncoded(); struct symbol **result; - struct menu *m = NULL; + struct menu *m = nullptr; if (str.isEmpty()) return; @@ -1208,7 +1208,7 @@ void ConfigInfoView::contextMenuEvent(QContextMenuEvent *event) } ConfigSearchWindow::ConfigSearchWindow(ConfigMainWindow *parent) - : Parent(parent), result(NULL) + : Parent(parent), result(nullptr) { setObjectName("search"); setWindowTitle("Search Config"); @@ -1281,7 +1281,7 @@ void ConfigSearchWindow::search(void) { struct symbol **p; struct property *prop; - ConfigItem *lastItem = NULL; + ConfigItem *lastItem = nullptr; free(result); list->clear(); @@ -1580,7 +1580,7 @@ void ConfigMainWindow::changeMenu(struct menu *menu) void ConfigMainWindow::setMenuLink(struct menu *menu) { struct menu *parent; - ConfigList* list = NULL; + ConfigList* list = nullptr; ConfigItem* item; if (configList->menuSkip(menu)) @@ -1859,7 +1859,7 @@ int main(int ac, char** av) cmdline.process(*configApp); if (cmdline.isSet(silent)) - conf_set_message_callback(NULL); + conf_set_message_callback(nullptr); QStringList args = cmdline.positionalArguments(); if (args.isEmpty()) From patchwork Wed Oct 23 06:36:10 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Rolf Eike Beer X-Patchwork-Id: 13846540 Received: from mx1.emlix.com (mx1.emlix.com [178.63.209.131]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id F3DFC1482FE; Wed, 23 Oct 2024 06:36:12 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=178.63.209.131 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1729665375; cv=none; b=gsTORWcL3xjRsEUMNRgi7Cb6DwKr3okpImypN5P/Vwt1INHT6sVRqIzXx7JQxE6zIpnmmWuQt5Y1MCt1EF64QerjXFuDqbPcBPRBi7mZmOAT2eT79N8gLdYPLUr1kf7RLahfxehZQiNCcXzyYwyX1i+p72DsA9EscHLsM5qUr6U= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1729665375; c=relaxed/simple; bh=Hrtbj5gzhkwWoK1Nu8Kf80sdOybfLxs8lrIUMePveHg=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version:Content-Type; b=rSHgiDq0RcYxA0+WMrj7R00B/HIfUhNQKykWtAdr8kQcIpRUggiqx5Qtq3uzoV6kD6nsSsNVb0grvC53SDA8ccUeYltIOk+U7fuW6d2kHW2Cce/uZeuRTzfoL/USAkc79LxZbouoLbqdRat7+oj/SgSZgT+WWSx7z3hpOeeorCw= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=emlix.com; spf=pass smtp.mailfrom=emlix.com; arc=none smtp.client-ip=178.63.209.131 Authentication-Results: smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=emlix.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=emlix.com Received: from mailer.emlix.com (p5098be52.dip0.t-ipconnect.de [80.152.190.82]) (using TLSv1.2 with cipher ADH-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mx1.emlix.com (Postfix) with ESMTPS id 24EE65F976; Wed, 23 Oct 2024 08:36:11 +0200 (CEST) From: Rolf Eike Beer To: Masahiro Yamada Cc: linux-kbuild@vger.kernel.org, linux-kernel@vger.kernel.org Subject: [PATCH 6/7] kconfig: qconf: use default platform shortcuts Date: Wed, 23 Oct 2024 08:36:10 +0200 Message-ID: <22467307.EfDdHjke4D@devpool47.emlix.com> Organization: emlix GmbH In-Reply-To: <4960180.31r3eYUQgx@devpool47.emlix.com> References: <4960180.31r3eYUQgx@devpool47.emlix.com> Precedence: bulk X-Mailing-List: linux-kbuild@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 This renames "Load" to "Open" and switches Ctrl-L to Ctrl-O for the default platforms. This may break the workflow for those used to it, but will make it actually work for everyone else like me who would just expect the default behavior. Add some more standard shortcuts where available. If they replace the existing shortcuts they would have the same value in my case. Signed-off-by: Rolf Eike Beer --- scripts/kconfig/qconf.cc | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) diff --git a/scripts/kconfig/qconf.cc b/scripts/kconfig/qconf.cc index 563ef8543d7c..4b2f707c9203 100644 --- a/scripts/kconfig/qconf.cc +++ b/scripts/kconfig/qconf.cc @@ -1361,21 +1361,22 @@ ConfigMainWindow::ConfigMainWindow(void) configList->setFocus(); backAction = new QAction(QPixmap(xpm_back), "Back", this); + backAction->setShortcut(QKeySequence::Back); connect(backAction, &QAction::triggered, this, &ConfigMainWindow::goBack); QAction *quitAction = new QAction("&Quit", this); - quitAction->setShortcut(Qt::CTRL | Qt::Key_Q); + quitAction->setShortcut(QKeySequence::Quit); connect(quitAction, &QAction::triggered, this, &ConfigMainWindow::close); - QAction *loadAction = new QAction(QPixmap(xpm_load), "&Load", this); - loadAction->setShortcut(Qt::CTRL | Qt::Key_L); + QAction *loadAction = new QAction(QPixmap(xpm_load), "&Open", this); + loadAction->setShortcut(QKeySequence::Open); connect(loadAction, &QAction::triggered, this, &ConfigMainWindow::loadConfig); saveAction = new QAction(QPixmap(xpm_save), "&Save", this); - saveAction->setShortcut(Qt::CTRL | Qt::Key_S); + saveAction->setShortcut(QKeySequence::Save); connect(saveAction, &QAction::triggered, this, &ConfigMainWindow::saveConfig); @@ -1384,10 +1385,11 @@ ConfigMainWindow::ConfigMainWindow(void) configname = conf_get_configname(); QAction *saveAsAction = new QAction("Save &As...", this); + saveAsAction->setShortcut(QKeySequence::SaveAs); connect(saveAsAction, &QAction::triggered, this, &ConfigMainWindow::saveConfigAs); QAction *searchAction = new QAction("&Find", this); - searchAction->setShortcut(Qt::CTRL | Qt::Key_F); + searchAction->setShortcut(QKeySequence::Find); connect(searchAction, &QAction::triggered, this, &ConfigMainWindow::searchConfig); singleViewAction = new QAction(QPixmap(xpm_single_view), "Single View", this); From patchwork Wed Oct 23 06:39:15 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Rolf Eike Beer X-Patchwork-Id: 13846543 Received: from mx1.emlix.com (mx1.emlix.com [178.63.209.131]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id DADA314A4DE; Wed, 23 Oct 2024 06:39:17 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=178.63.209.131 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1729665560; cv=none; b=k+j01SbA4K8Z627xsY2nCEdkWmtPDp4THPxxEh5wnl2DyvBTFSpbLxqwwBBTtr9WWe8KlvBejZUlCBVN/szEm/1BSUfEVvAdsFdFrEGMEnZ5SBgHk9kPYo0JbpoRTPHghSmlza/h2+X7vhUzwZXONKdgeTtsEEe/cn89MbEGL9E= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1729665560; c=relaxed/simple; bh=XYMrAKGPn3G7hN4PF2Z2mZGMRGRjPfTIzYJUmtHmcjI=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version:Content-Type; b=Z3Ie80G6QE5/WDk1nAJ7oAwR3vKnnf+FYcJBn8EzBSpagA2mK/63Mk8tjbWuAjf437WCXmx2OErhcqCIx0D0sIXy3dcAUV4Ivrl/Sb0LhEDq6QNPzMC2vggKpbzpg+LUFRfSmRNL2zDCnpean7YTj+e/QFyNFCMFN1IUHHEsAgw= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=emlix.com; spf=pass smtp.mailfrom=emlix.com; arc=none smtp.client-ip=178.63.209.131 Authentication-Results: smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=emlix.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=emlix.com Received: from mailer.emlix.com (p5098be52.dip0.t-ipconnect.de [80.152.190.82]) (using TLSv1.2 with cipher ADH-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mx1.emlix.com (Postfix) with ESMTPS id 0C2EE5F8A7; Wed, 23 Oct 2024 08:39:16 +0200 (CEST) From: Rolf Eike Beer To: Masahiro Yamada Cc: linux-kbuild@vger.kernel.org, linux-kernel@vger.kernel.org Subject: [PATCH 7/7] kconfig: qconf: simplify character replacement Date: Wed, 23 Oct 2024 08:39:15 +0200 Message-ID: <3592638.iIbC2pHGDl@devpool47.emlix.com> Organization: emlix GmbH In-Reply-To: <4960180.31r3eYUQgx@devpool47.emlix.com> References: <4960180.31r3eYUQgx@devpool47.emlix.com> Precedence: bulk X-Mailing-List: linux-kbuild@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Replace the hand crafted lookup table with a QHash. This has the nice benefit that the added offsets can not get out of sync with the length of the replacement strings. Signed-off-by: Rolf Eike Beer --- scripts/kconfig/qconf.cc | 33 ++++++++++++--------------------- 1 file changed, 12 insertions(+), 21 deletions(-) diff --git a/scripts/kconfig/qconf.cc b/scripts/kconfig/qconf.cc index 4b2f707c9203..f07a463c5760 100644 --- a/scripts/kconfig/qconf.cc +++ b/scripts/kconfig/qconf.cc @@ -1123,28 +1123,19 @@ QString ConfigInfoView::print_filter(const QString &str) { QRegularExpression re("[<>&\"\\n]"); QString res = str; + + QHash patterns; + patterns['<'] = "<"; + patterns['>'] = ">"; + patterns['&'] = "&"; + patterns['"'] = """; + patterns['\n'] = "
"; + for (int i = 0; (i = res.indexOf(re, i)) >= 0;) { - switch (res[i].toLatin1()) { - case '<': - res.replace(i, 1, "<"); - i += 4; - break; - case '>': - res.replace(i, 1, ">"); - i += 4; - break; - case '&': - res.replace(i, 1, "&"); - i += 5; - break; - case '"': - res.replace(i, 1, """); - i += 6; - break; - case '\n': - res.replace(i, 1, "
"); - i += 4; - break; + const QString n = patterns.value(res[i], QString()); + if (!n.isEmpty()) { + res.replace(i, 1, n); + i += n.length(); } } return res;