Ticket #14924 (closed optimization: fixed)

Opened 5 months ago

Last modified 5 months ago

[patch] cleanup redundant initialization of local variable in src/ribbon/toolbar.cpp

Reported by: ettl.martin Owned by:
Priority: normal Milestone:
Component: GUI-all Version: 2.9-svn
Keywords: Cc:
Blocked By: Patch: yes
Blocking:

Description

Please review the attached patch, which cleans up the following code:

    wxOrientation major_axis = m_art->GetFlags() & wxRIBBON_BAR_FLOW_VERTICAL ?
        wxVERTICAL : wxHORIZONTAL;

    // A toolbar should maximize its width whether vertical or horizontal, so
    // force the major axis to be horizontal. Without this, there will be
    // redundant horizontal space.
    major_axis = wxHORIZONTAL;

This local variable is first initialized by wxVERTICAL or wxHORIZONTAL ( depending on the flag settings ). Then it is initialized again with wxHORIZONTAL. Either there is a logical mistake, or the code can be reduced to:

    wxOrientation major_axis = wxHORIZONTAL;

Best regards and many thanks

Martin Ettl

Attachments

cleanup.diff download (0.7 KB) - added by ettl.martin 5 months ago.
proposed patch

Change History

Changed 5 months ago by ettl.martin

proposed patch

Changed 5 months ago by VZ

  • status changed from new to closed
  • resolution set to fixed

(In [73279]) No changes, just don't initialize the variable twice.

Remove the inactive code probably copy-and-pasted from somewhere else.

Closes #14924.

Note: See TracTickets for help on using tickets.