Skip to content

Commit

Permalink
Remove some VLAs (Variable Length array) (c++ extension).
Browse files Browse the repository at this point in the history
Unneeded BTW, as we already have vector.
  • Loading branch information
Jarod42 committed Mar 28, 2024
1 parent e29f7a5 commit b18221b
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 11 deletions.
7 changes: 1 addition & 6 deletions Plugin/clKeyboardManager.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -190,7 +190,6 @@ void clKeyboardManager::DoUpdateFrame(wxFrame* frame, MenuItemDataIntMap_t& acce
}

if(!table.empty() || !accels.empty()) {
wxAcceleratorEntry entries[table.size() + accels.size()];
// append the globals
clDEBUG() << "clKeyboardManager: appending global entries" << clEndl;
for(MenuItemDataIntMap_t::iterator iter = accels.begin(); iter != accels.end(); ++iter) {
Expand All @@ -204,11 +203,7 @@ void clKeyboardManager::DoUpdateFrame(wxFrame* frame, MenuItemDataIntMap_t& acce
}
}

for(size_t i = 0; i < table.size(); ++i) {
entries[i] = table.at(i);
}

wxAcceleratorTable acceleTable(table.size(), entries);
wxAcceleratorTable acceleTable(table.size(), table.data());
frame->SetAcceleratorTable(acceleTable);
}
}
Expand Down
6 changes: 1 addition & 5 deletions Plugin/wxTerminalCtrl/wxTerminalInputCtrl.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -100,11 +100,7 @@ wxTerminalInputCtrl::wxTerminalInputCtrl(wxTerminalCtrl* parent)
V.push_back(wxAcceleratorEntry{ wxACCEL_RAW_CTRL, (int)'C', XRCID("ID_ctrl_c") });
V.push_back(wxAcceleratorEntry{ wxACCEL_RAW_CTRL, (int)'W', XRCID("ID_delete_word") });

wxAcceleratorEntry accel_entries[V.size()];
for (size_t i = 0; i < V.size(); ++i) {
accel_entries[i] = V[i];
}
wxAcceleratorTable accel_table(V.size(), accel_entries);
wxAcceleratorTable accel_table(V.size(), V.data());

m_ctrl->SetAcceleratorTable(accel_table);
m_ctrl->Bind(wxEVT_MENU, &wxTerminalInputCtrl::OnCommandComplete, this, XRCID("ID_command"));
Expand Down

0 comments on commit b18221b

Please sign in to comment.