diff mbox series

[3/4] kconfig: qconf: remove overloaded constructor

Message ID 2207289.irdbgypaU6@devpool47.emlix.com (mailing list archive)
State New
Headers show
Series improve qconfig C++ code, take 2 | expand

Commit Message

Rolf Eike Beer Dec. 19, 2024, 7:22 a.m. UTC
No extra implementation is needed for this variant, provide a default argument
to the matching sibling instead.

Signed-off-by: Rolf Eike Beer <eb@emlix.com>
---
 scripts/kconfig/qconf.h | 7 +------
 1 file changed, 1 insertion(+), 6 deletions(-)

Comments

Masahiro Yamada Jan. 10, 2025, 5:29 p.m. UTC | #1
On Thu, Dec 19, 2024 at 4:23 PM Rolf Eike Beer <eb@emlix.com> wrote:
>
> No extra implementation is needed for this variant, provide a default argument
> to the matching sibling instead.


I am not sure if this is equivalent conversion
because you are changing goParent(true)
into goParent(false).




> Signed-off-by: Rolf Eike Beer <eb@emlix.com>
> ---
>  scripts/kconfig/qconf.h | 7 +------
>  1 file changed, 1 insertion(+), 6 deletions(-)
>
> diff --git a/scripts/kconfig/qconf.h b/scripts/kconfig/qconf.h
> index 62ab3286d04f..1c90fec4c2da 100644
> --- a/scripts/kconfig/qconf.h
> +++ b/scripts/kconfig/qconf.h
> @@ -114,7 +114,7 @@ public slots:
>  class ConfigItem : public QTreeWidgetItem {
>         typedef class QTreeWidgetItem Parent;
>  public:
> -       ConfigItem(ConfigList *parent, ConfigItem *after, struct menu *m)
> +       ConfigItem(ConfigList *parent, ConfigItem *after, struct menu *m = nullptr)
>         : Parent(parent, after), nextItem(0), menu(m), goParent(false)
>         {
>                 init();
> @@ -124,11 +124,6 @@ class ConfigItem : public QTreeWidgetItem {
>         {
>                 init();
>         }
> -       ConfigItem(ConfigList *parent, ConfigItem *after)
> -       : Parent(parent, after), nextItem(0), menu(0), goParent(true)
> -       {
> -               init();
> -       }
>         ~ConfigItem(void);
>         void init(void);
>         void updateMenu(void);
> --
> 2.47.1
>
>
> --
> Rolf Eike Beer
>
> emlix GmbH
> Headquarters: Berliner Str. 12, 37073 Göttingen, Germany
> Phone +49 (0)551 30664-0, e-mail info@emlix.com
> District Court of Göttingen, Registry Number HR B 3160
> Managing Directors: Heike Jordan, Dr. Uwe Kracke
> VAT ID No. DE 205 198 055
> Office Berlin: Panoramastr. 1, 10178 Berlin, Germany
> Office Bonn: Bachstr. 6, 53115 Bonn, Germany
> http://www.emlix.com
>
> emlix - your embedded Linux partner
>
>
Rolf Eike Beer Jan. 14, 2025, 1:03 p.m. UTC | #2
On Freitag, 10. Januar 2025 18:29:06 Mitteleuropäische Normalzeit Masahiro 
Yamada wrote:
> On Thu, Dec 19, 2024 at 4:23 PM Rolf Eike Beer <eb@emlix.com> wrote:
> > No extra implementation is needed for this variant, provide a default
> > argument to the matching sibling instead.
> 
> I am not sure if this is equivalent conversion
> because you are changing goParent(true)
> into goParent(false).

It is not, for exactly that reason. Found that out the hard way, i.e. it 
crashes in some situations which I didn't notice before. I'll send an updated 
patch.

Regards,

Eike
diff mbox series

Patch

diff --git a/scripts/kconfig/qconf.h b/scripts/kconfig/qconf.h
index 62ab3286d04f..1c90fec4c2da 100644
--- a/scripts/kconfig/qconf.h
+++ b/scripts/kconfig/qconf.h
@@ -114,7 +114,7 @@  public slots:
 class ConfigItem : public QTreeWidgetItem {
 	typedef class QTreeWidgetItem Parent;
 public:
-	ConfigItem(ConfigList *parent, ConfigItem *after, struct menu *m)
+	ConfigItem(ConfigList *parent, ConfigItem *after, struct menu *m = nullptr)
 	: Parent(parent, after), nextItem(0), menu(m), goParent(false)
 	{
 		init();
@@ -124,11 +124,6 @@  class ConfigItem : public QTreeWidgetItem {
 	{
 		init();
 	}
-	ConfigItem(ConfigList *parent, ConfigItem *after)
-	: Parent(parent, after), nextItem(0), menu(0), goParent(true)
-	{
-		init();
-	}
 	~ConfigItem(void);
 	void init(void);
 	void updateMenu(void);