Swap Boost.Container's small_vector out for LLVM's

This implementation misses a shrink to fit function, but reassigning the
vector with a fresh one should be equivalent.
This commit is contained in:
Robbert van der Helm
2022-04-14 23:31:14 +02:00
parent fd25010aca
commit b2a15620f3
18 changed files with 1601 additions and 97 deletions
+1 -1
View File
@@ -245,7 +245,7 @@ class Vst2Bridge : public HostBridge {
* practice every host will bundle all events in a single
* `effProcessEvents()` call.
*/
boost::container::small_vector<DynamicVstEvents, 1>
llvm::SmallVector<DynamicVstEvents, 1>
next_audio_buffer_midi_events_;
/**
* Whether `next_audio_buffer_midi_events` should be cleared before
+4 -5
View File
@@ -19,7 +19,7 @@
#include <iostream>
#include <sstream>
#include <boost/container/small_vector.hpp>
#include <llvm/small-vector.h>
using namespace std::literals::chrono_literals;
using namespace std::literals::string_literals;
@@ -132,7 +132,7 @@ static const HCURSOR arrow_cursor = LoadCursor(nullptr, IDC_ARROW);
* @return A non-empty list containing `starting_at` and all of its ancestor
* windows `starting_at`.
*/
boost::container::small_vector<xcb_window_t, 8> find_ancestor_windows(
llvm::SmallVector<xcb_window_t, 8> find_ancestor_windows(
xcb_connection_t& x11_connection,
xcb_window_t starting_at);
@@ -1238,7 +1238,7 @@ LRESULT CALLBACK window_proc(HWND handle,
return DefWindowProc(handle, message, wParam, lParam);
}
boost::container::small_vector<xcb_window_t, 8> find_ancestor_windows(
llvm::SmallVector<xcb_window_t, 8> find_ancestor_windows(
xcb_connection_t& x11_connection,
xcb_window_t starting_at) {
xcb_window_t current_window = starting_at;
@@ -1250,8 +1250,7 @@ boost::container::small_vector<xcb_window_t, 8> find_ancestor_windows(
THROW_X11_ERROR(error);
const xcb_window_t root = query_reply->root;
boost::container::small_vector<xcb_window_t, 8> ancestor_windows{
current_window};
llvm::SmallVector<xcb_window_t, 8> ancestor_windows{current_window};
while (query_reply->parent != root) {
current_window = query_reply->parent;
ancestor_windows.push_back(current_window);
+1
View File
@@ -66,6 +66,7 @@ host_common_sources = files(
'../common/plugins.cpp',
'../common/process.cpp',
'../common/utils.cpp',
'../include/llvm/small-vector.cpp',
'bridges/common.cpp',
'bridges/vst2.cpp',
'editor.cpp',
+4 -4
View File
@@ -192,9 +192,9 @@ WineXdndProxy::Handle WineXdndProxy::get_handle() {
return Handle(instance);
}
void WineXdndProxy::begin_xdnd(const boost::container::small_vector_base<
ghc::filesystem::path>& file_paths,
HWND tracker_window) {
void WineXdndProxy::begin_xdnd(
const llvm::SmallVectorImpl<ghc::filesystem::path>& file_paths,
HWND tracker_window) {
if (file_paths.empty()) {
throw std::runtime_error("Cannot drag-and-drop without any files");
}
@@ -815,7 +815,7 @@ void CALLBACK dnd_winevent_callback(HWINEVENTHOOK /*hWinEventHook*/,
}
// This will contain the normal, Unix-style paths to the files
boost::container::small_vector<fs::path, 4> dragged_files;
llvm::SmallVector<fs::path, 4> dragged_files;
for (unsigned int format_idx = 0; format_idx < num_formats; format_idx++) {
STGMEDIUM storage{};
if (HRESULT result = tracker_info->dataObject->GetData(
+4 -4
View File
@@ -26,8 +26,8 @@
#include <xcb/xcb.h>
#pragma pop_macro("_WIN32")
#include <llvm/small-vector.h>
#include <windows.h>
#include <boost/container/small_vector.hpp>
#include <ghc/filesystem.hpp>
#include "utils.h"
@@ -149,9 +149,9 @@ class WineXdndProxy {
* Initiate the XDDN protocol by taking ownership of the `XdndSelection`
* selection and setting up the event listeners.
*/
void begin_xdnd(const boost::container::small_vector_base<
ghc::filesystem::path>& file_paths,
HWND tracker_window);
void begin_xdnd(
const llvm::SmallVectorImpl<ghc::filesystem::path>& file_paths,
HWND tracker_window);
/**
* Release ownership of the selection stop listening for X11 events.