From fa1e13e60669923e656ed119fed68b89bc76d289 Mon Sep 17 00:00:00 2001 From: Mystro256 Date: Fri, 17 Feb 2017 23:50:00 -0500 Subject: [PATCH] Use prefix add operator for non-prim types Typically yields better or equal performance. Sometimes compilers don't optimizer out keeping the previous values (not needed for only adding 1) --- src/wx/guiinit.cpp | 14 +++++++------- src/wx/opts.cpp | 8 ++++---- src/wx/viewsupt.cpp | 4 ++-- 3 files changed, 13 insertions(+), 13 deletions(-) diff --git a/src/wx/guiinit.cpp b/src/wx/guiinit.cpp index 41c597eb..c2256ce7 100644 --- a/src/wx/guiinit.cpp +++ b/src/wx/guiinit.cpp @@ -43,7 +43,7 @@ const w->SetExtraStyle(w->GetExtraStyle() | wxWS_EX_VALIDATE_RECURSIVELY); wxWindowList l = w->GetChildren(); - for (wxWindowList::iterator ch = l.begin(); ch != l.end(); ch++) + for (wxWindowList::iterator ch = l.begin(); ch != l.end(); ++ch) mark_recursive(*ch); } @@ -2020,7 +2020,7 @@ public: // first drop from user accels, if applicable for (wxAcceleratorEntry_v::iterator i = user_accels.begin(); - i < user_accels.end(); i++) + i < user_accels.end(); ++i) if (i->GetFlags() == selmod && i->GetKeyCode() == selkey) { user_accels.erase(i); break; @@ -2037,7 +2037,7 @@ public: // finally, remove from accels instead of recomputing for (wxAcceleratorEntry_v::iterator i = accels.begin(); - i < accels.end(); i++) + i < accels.end(); ++i) if (i->GetFlags() == selmod && i->GetKeyCode() == selkey) { accels.erase(i); break; @@ -2081,7 +2081,7 @@ public: // first drop from user accels, if applicable for (wxAcceleratorEntry_v::iterator i = user_accels.begin(); - i < user_accels.end(); i++) + i < user_accels.end(); ++i) if (i->GetFlags() == acmod && i->GetKeyCode() == ackey) { user_accels.erase(i); break; @@ -2149,7 +2149,7 @@ void MainFrame::add_menu_accels(wxTreeCtrl* tc, wxTreeItemId& parent, wxMenu* me { wxMenuItemList mil = menu->GetMenuItems(); - for (wxMenuItemList::iterator mi = mil.begin(); mi != mil.end(); mi++) { + for (wxMenuItemList::iterator mi = mil.begin(); mi != mil.end(); ++mi) { if ((*mi)->IsSeparator()) { tc->AppendItem(parent, wxT("-----")); } else if ((*mi)->IsSubMenu()) { @@ -2374,7 +2374,7 @@ wxAcceleratorEntry_v MainFrame::get_accels(wxAcceleratorEntry_v user_accels) for (int i = 0; i < user_accels.size(); i++) { const wxAcceleratorEntry& ae = user_accels[i]; - for (wxAcceleratorEntry_v::iterator e = accels.begin(); e < accels.end(); e++) + for (wxAcceleratorEntry_v::iterator e = accels.begin(); e < accels.end(); ++e) if (ae.GetFlags() == e->GetFlags() && ae.GetKeyCode() == e->GetKeyCode()) { accels.erase(e); break; @@ -2636,7 +2636,7 @@ bool MainFrame::BindControls() // only add it if not already there for (wxAcceleratorEntry_v::iterator e = sys_accels.begin(); - e < sys_accels.end(); e++) + e < sys_accels.end(); ++e) if (a->GetFlags() == e->GetFlags() && a->GetKeyCode() == e->GetKeyCode()) { if (e->GetMenuItem()) { wxLogInfo(_("Duplicate menu accelerator: %s for %s and %s; keeping first"), diff --git a/src/wx/opts.cpp b/src/wx/opts.cpp index f89e6759..0cac7547 100644 --- a/src/wx/opts.cpp +++ b/src/wx/opts.cpp @@ -746,7 +746,7 @@ void update_opts() cfg->SetPath(wxT("/Keyboard")); for (wxAcceleratorEntry_v::iterator i = gopts.accels.begin(); - i < gopts.accels.end(); i++) { + i < gopts.accels.end(); ++i) { int cmd_id = i->GetCommand(); int cmd; @@ -756,7 +756,7 @@ void update_opts() wxAcceleratorEntry_v::iterator j; - for (j = i + 1; j < gopts.accels.end(); j++) + for (j = i + 1; j < gopts.accels.end(); ++j) if (j->GetCommand() != cmd_id) break; @@ -880,11 +880,11 @@ bool opt_set(const wxChar* name, const wxChar* val) return false; for (wxAcceleratorEntry_v::iterator i = gopts.accels.begin(); - i < gopts.accels.end(); i++) + i < gopts.accels.end(); ++i) if (i->GetCommand() == cmd->cmd_id) { wxAcceleratorEntry_v::iterator j; - for (j = i; j < gopts.accels.end(); j++) + for (j = i; j < gopts.accels.end(); ++j) if (j->GetCommand() != cmd->cmd_id) break; diff --git a/src/wx/viewsupt.cpp b/src/wx/viewsupt.cpp index ad6e1f39..eba7121d 100644 --- a/src/wx/viewsupt.cpp +++ b/src/wx/viewsupt.cpp @@ -9,7 +9,7 @@ void Viewer::CloseDlg(wxCloseEvent& ev) MainFrame* f = wxGetApp().frame; for (dialog_list_t::iterator i = f->popups.begin(); - i != f->popups.end(); i++) + i != f->popups.end(); ++i) if (*i == this) { f->popups.erase(i); break; @@ -63,7 +63,7 @@ END_EVENT_TABLE() void MainFrame::UpdateViewers() { - for (dialog_list_t::iterator i = popups.begin(); i != popups.end(); i++) { + for (dialog_list_t::iterator i = popups.begin(); i != popups.end(); ++i) { Viewers::Viewer* d = static_cast(*i); if (d->auto_update)