From patchwork Thu Dec 19 07:22: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: 13914550 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 842607082A; Thu, 19 Dec 2024 07:23:13 +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=1734592996; cv=none; b=Zejc2SyFMSKgHRDN3R4vjQz457muvQDtkhKYZTq81BD53AzpeZX4MoaBCKDAY6fYTehJTaR8RbCtA5YszE0AX2i/kxdl1pDq1AITDklqGFJcr/gbmtksvgLPAZ8w3bV38kB97buhYUl4EjSydnYvfx95UtLoUo3p//MtJMbhMak= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1734592996; c=relaxed/simple; bh=TVzI0563c4bn+xjscJQaU/9w+t12qIXwTg7ww21M9kM=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version:Content-Type; b=sr5TgWAJFn4middw5KspHhX7Ef0MHfV5WtRJxqGq3aHS1Rk/Q96HD9hsiq2S7xeFEihOAGMSr7fLDme7ufrQEFN00emHLrHcrmBaQFE4yz2tbPJOxe6GO4IY7BqhPPDK0RahBjC9bJGMiMe+N1hvgEEt0RHWSJcfTSlO6UXHesI= 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 3D1175F8DD; Thu, 19 Dec 2024 08:23:11 +0100 (CET) From: Rolf Eike Beer To: Masahiro Yamada Cc: linux-kbuild@vger.kernel.org, linux-kernel@vger.kernel.org Subject: [PATCH 4/4] kconfig: qconf: use nullptr in C++11 code Date: Thu, 19 Dec 2024 08:22:59 +0100 Message-ID: <2968348.e9J7NaK4W3@devpool47.emlix.com> Organization: emlix GmbH In-Reply-To: <5843611.DvuYhMxLoT@devpool47.emlix.com> References: <5843611.DvuYhMxLoT@devpool47.emlix.com> Precedence: bulk X-Mailing-List: linux-kbuild@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 This C++11 keyword is typesafe, i.e. it can't be assigned to non-pointers, and it makes it visually clear that this is about a pointer. Signed-off-by: Rolf Eike Beer --- scripts/kconfig/qconf.cc | 42 ++++++++++++++++++++-------------------- scripts/kconfig/qconf.h | 8 ++++---- 2 files changed, 25 insertions(+), 25 deletions(-) diff --git a/scripts/kconfig/qconf.cc b/scripts/kconfig/qconf.cc index 4d500cc9ba9d..7cfd19dadc51 100644 --- a/scripts/kconfig/qconf.cc +++ b/scripts/kconfig/qconf.cc @@ -303,7 +303,7 @@ ConfigList::ConfigList(QWidget *parent, const char *name) : QTreeWidget(parent), updateAll(false), showName(false), mode(singleMode), optMode(normalOpt), - rootEntry(0), headerPopup(0) + rootEntry(nullptr), headerPopup(nullptr) { setObjectName(name); setSortingEnabled(false); @@ -417,7 +417,7 @@ void ConfigList::updateSelection(void) void ConfigList::updateList() { - ConfigItem* last = 0; + ConfigItem* last = nullptr; ConfigItem *item; if (!rootEntry) { @@ -439,7 +439,7 @@ void ConfigList::updateList() if (rootEntry != &rootmenu && mode == singleMode) { item = (ConfigItem *)topLevelItem(0); if (!item) - item = new ConfigItem(this, 0); + item = new ConfigItem(this, nullptr); last = item; } if ((mode == singleMode || (mode == symbolMode && !(rootEntry->flags & MENU_ROOT))) && @@ -489,7 +489,7 @@ void ConfigList::setValue(ConfigItem* item, tristate val) int type; tristate oldval; - sym = item->menu ? item->menu->sym : 0; + sym = item->menu ? item->menu->sym : nullptr; if (!sym) return; @@ -553,7 +553,7 @@ void ConfigList::setRootMenu(struct menu *menu) type = menu && menu->prompt ? menu->prompt->type : P_UNKNOWN; if (type != P_MENU) return; - updateMenuList(0); + updateMenuList(nullptr); rootEntry = menu; updateListAll(); if (currentItem()) { @@ -610,7 +610,7 @@ void ConfigList::updateMenuList(ConfigItem *parent, struct menu* menu) last = parent->firstChild(); if (last && !last->goParent) - last = 0; + last = nullptr; for (child = menu->list; child; child = child->next) { item = last ? last->nextSibling() : parent->firstChild(); type = child->prompt ? child->prompt->type : P_UNKNOWN; @@ -639,7 +639,7 @@ void ConfigList::updateMenuList(ConfigItem *parent, struct menu* menu) if (mode == fullMode || mode == menuMode || type != P_MENU) updateMenuList(item, child); else - updateMenuList(item, 0); + updateMenuList(item, nullptr); last = item; continue; } @@ -647,7 +647,7 @@ hide: if (item && item->menu == child) { last = parent->firstChild(); if (last == item) - last = 0; + last = nullptr; else while (last->nextSibling() != item) last = last->nextSibling(); delete item; @@ -673,7 +673,7 @@ void ConfigList::updateMenuList(struct menu *menu) last = (ConfigItem *)topLevelItem(0); if (last && !last->goParent) - last = 0; + last = nullptr; for (child = menu->list; child; child = child->next) { item = last ? last->nextSibling() : (ConfigItem *)topLevelItem(0); type = child->prompt ? child->prompt->type : P_UNKNOWN; @@ -702,7 +702,7 @@ void ConfigList::updateMenuList(struct menu *menu) if (mode == fullMode || mode == menuMode || type != P_MENU) updateMenuList(item, child); else - updateMenuList(item, 0); + updateMenuList(item, nullptr); last = item; continue; } @@ -710,7 +710,7 @@ hide: if (item && item->menu == child) { last = (ConfigItem *)topLevelItem(0); if (last == item) - last = 0; + last = nullptr; else while (last->nextSibling() != item) last = last->nextSibling(); delete item; @@ -853,7 +853,7 @@ skip: void ConfigList::focusInEvent(QFocusEvent *e) { - struct menu *menu = NULL; + struct menu *menu = nullptr; Parent::focusInEvent(e); @@ -912,7 +912,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); @@ -964,7 +964,7 @@ void ConfigInfoView::setInfo(struct menu *m) if (_menu == m) return; _menu = m; - sym = NULL; + sym = nullptr; if (!_menu) clear(); else @@ -1156,7 +1156,7 @@ void ConfigInfoView::contextMenuEvent(QContextMenuEvent *event) } ConfigSearchWindow::ConfigSearchWindow(ConfigMainWindow *parent) - : Parent(parent), result(NULL) + : Parent(parent), result(nullptr) { setObjectName("search"); setWindowTitle("Search Config"); @@ -1228,7 +1228,7 @@ void ConfigSearchWindow::search(void) { struct symbol **p; struct property *prop; - ConfigItem *lastItem = NULL; + ConfigItem *lastItem = nullptr; free(result); list->clear(); @@ -1247,7 +1247,7 @@ void ConfigSearchWindow::search(void) * Construct the complete config widget */ ConfigMainWindow::ConfigMainWindow(void) - : searchWindow(0) + : searchWindow(nullptr) { bool ok = true; QVariant x, y; @@ -1524,7 +1524,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)) @@ -1601,7 +1601,7 @@ void ConfigMainWindow::showSingleView(void) backAction->setEnabled(true); menuList->hide(); - menuList->setRootMenu(0); + menuList->setRootMenu(nullptr); configList->mode = singleMode; if (configList->rootEntry == &rootmenu) configList->updateListAll(); @@ -1647,7 +1647,7 @@ void ConfigMainWindow::showFullView(void) backAction->setEnabled(false); menuList->hide(); - menuList->setRootMenu(0); + menuList->setRootMenu(nullptr); configList->mode = fullMode; if (configList->rootEntry == &rootmenu) configList->updateListAll(); @@ -1800,7 +1800,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()) diff --git a/scripts/kconfig/qconf.h b/scripts/kconfig/qconf.h index 1c90fec4c2da..5f6c57383aba 100644 --- a/scripts/kconfig/qconf.h +++ b/scripts/kconfig/qconf.h @@ -42,7 +42,7 @@ class ConfigList : public QTreeWidget { Q_OBJECT typedef class QTreeWidget Parent; public: - ConfigList(QWidget *parent, const char *name = 0); + ConfigList(QWidget *parent, const char *name = nullptr); ~ConfigList(); void reinit(void); ConfigItem* findConfigItem(struct menu *); @@ -115,12 +115,12 @@ class ConfigItem : public QTreeWidgetItem { typedef class QTreeWidgetItem Parent; public: ConfigItem(ConfigList *parent, ConfigItem *after, struct menu *m = nullptr) - : Parent(parent, after), nextItem(0), menu(m), goParent(false) + : Parent(parent, after), nextItem(nullptr), menu(m), goParent(false) { init(); } ConfigItem(ConfigItem *parent, ConfigItem *after, struct menu *m) - : Parent(parent, after), nextItem(0), menu(m), goParent(false) + : Parent(parent, after), nextItem(nullptr), menu(m), goParent(false) { init(); } @@ -180,7 +180,7 @@ class ConfigInfoView : public QTextBrowser { typedef class QTextBrowser Parent; QMenu *contextMenu; public: - ConfigInfoView(QWidget* parent, const char *name = 0); + ConfigInfoView(QWidget* parent, const char *name = nullptr); bool showDebug(void) const { return _showDebug; } public slots: