#14924 closed optimization (fixed)

[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: stable-latest
Keywords: Cc:
Blocked By: Blocking:
Patch: yes

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 (1)

cleanup.diff download (751 bytes) - added by ettl.martin 19 months ago.
proposed patch

Download all attachments as: .zip

Change History (2)

Changed 19 months ago by ettl.martin

proposed patch

comment:1 Changed 19 months ago by VZ

  • Resolution set to fixed
  • Status changed from new to closed

(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.