From b18221b0c6c2c7dab3fce32ec4b5cd89d2e1289f Mon Sep 17 00:00:00 2001 From: Jarod42 Date: Thu, 28 Mar 2024 18:10:23 +0100 Subject: [PATCH] Remove some VLAs (Variable Length array) (c++ extension). Unneeded BTW, as we already have vector. --- Plugin/clKeyboardManager.cpp | 7 +------ Plugin/wxTerminalCtrl/wxTerminalInputCtrl.cpp | 6 +----- 2 files changed, 2 insertions(+), 11 deletions(-) diff --git a/Plugin/clKeyboardManager.cpp b/Plugin/clKeyboardManager.cpp index 39af2c3a57..93f99959ff 100644 --- a/Plugin/clKeyboardManager.cpp +++ b/Plugin/clKeyboardManager.cpp @@ -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) { @@ -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); } } diff --git a/Plugin/wxTerminalCtrl/wxTerminalInputCtrl.cpp b/Plugin/wxTerminalCtrl/wxTerminalInputCtrl.cpp index d996c8a81b..28a81858ee 100644 --- a/Plugin/wxTerminalCtrl/wxTerminalInputCtrl.cpp +++ b/Plugin/wxTerminalCtrl/wxTerminalInputCtrl.cpp @@ -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"));