mirror of
https://github.com/VectorCamp/vectorscan.git
synced 2025-09-29 19:24:25 +03:00
use STL make_unique, remove wrapper header, breaks C++17 compilation
This commit is contained in:
@@ -32,7 +32,6 @@
|
||||
#include "ue2common.h"
|
||||
#include "rose/rose_build_scatter.h"
|
||||
#include "util/compile_error.h"
|
||||
#include "util/make_unique.h"
|
||||
#include "util/multibit.h"
|
||||
#include "util/multibit_build.h"
|
||||
|
||||
@@ -49,10 +48,10 @@ class mmbit_holder {
|
||||
public:
|
||||
mmbit_holder() {}
|
||||
explicit mmbit_holder(u32 num_bits, u32 excess = 0)
|
||||
: data(ue2::make_unique<u8[]>(mmbit_size(num_bits) + 7 + excess)) {}
|
||||
: data(std::make_unique<u8[]>(mmbit_size(num_bits) + 7 + excess)) {}
|
||||
void init(u32 num_bits) {
|
||||
assert(!data);
|
||||
data = ue2::make_unique<u8[]>(mmbit_size(num_bits) + 7);
|
||||
data = std::make_unique<u8[]>(mmbit_size(num_bits) + 7);
|
||||
}
|
||||
operator u8 *() {
|
||||
assert(data);
|
||||
@@ -727,7 +726,7 @@ TEST_P(MultiBitTest, InitRangeChunked) {
|
||||
}
|
||||
|
||||
static
|
||||
void apply(const scatter_plan_raw &sp, u8 *out) {
|
||||
void applyMB(const scatter_plan_raw &sp, u8 *out) {
|
||||
for (const auto &e : sp.p_u64a) {
|
||||
memcpy(out + e.offset, &e.val, sizeof(e.val));
|
||||
}
|
||||
@@ -761,7 +760,7 @@ TEST_P(MultiBitTest, InitRangePlanChunked) {
|
||||
scatter_plan_raw sp;
|
||||
mmbBuildInitRangePlan(test_size, chunk_begin, chunk_end, &sp);
|
||||
memset(ba, 0xaa, mmbit_size(test_size));
|
||||
apply(sp, ba);
|
||||
applyMB(sp, ba);
|
||||
|
||||
// First bit set should be chunk_begin.
|
||||
ASSERT_EQ(chunk_begin, mmbit_iterate(ba, test_size, MMB_INVALID));
|
||||
|
@@ -31,7 +31,6 @@
|
||||
#include "gtest/gtest.h"
|
||||
#include "ue2common.h"
|
||||
#include "util/compile_error.h"
|
||||
#include "util/make_unique.h"
|
||||
#include "util/multibit.h"
|
||||
#include "util/multibit_build.h"
|
||||
#include "util/multibit_compress.h"
|
||||
@@ -86,10 +85,10 @@ class mmbit_holder {
|
||||
public:
|
||||
mmbit_holder() {}
|
||||
explicit mmbit_holder(u32 num_bits, u32 excess = 0)
|
||||
: data(ue2::make_unique<u8[]>(mmbit_size(num_bits) + 7 + excess)) {}
|
||||
: data(std::make_unique<u8[]>(mmbit_size(num_bits) + 7 + excess)) {}
|
||||
void init(u32 num_bits) {
|
||||
assert(!data);
|
||||
data = ue2::make_unique<u8[]>(mmbit_size(num_bits) + 7);
|
||||
data = std::make_unique<u8[]>(mmbit_size(num_bits) + 7);
|
||||
}
|
||||
operator u8 *() {
|
||||
assert(data);
|
||||
@@ -108,10 +107,10 @@ class comp_holder {
|
||||
public:
|
||||
comp_holder() {}
|
||||
explicit comp_holder(u32 length)
|
||||
: data(ue2::make_unique<u8[]>(length + 7)) {}
|
||||
: data(std::make_unique<u8[]>(length + 7)) {}
|
||||
void init(u32 length) {
|
||||
assert(!data);
|
||||
data = ue2::make_unique<u8[]>(length + 7);
|
||||
data = std::make_unique<u8[]>(length + 7);
|
||||
}
|
||||
operator u8 *() {
|
||||
assert(data);
|
||||
|
@@ -30,7 +30,6 @@
|
||||
|
||||
#include "gtest/gtest.h"
|
||||
#include "util/pack_bits.h"
|
||||
#include "util/make_unique.h"
|
||||
#include "ue2common.h"
|
||||
|
||||
#include <algorithm>
|
||||
@@ -92,7 +91,7 @@ void test_pack_and_unpack(const vector<T> &v, const vector<u32> &bits) {
|
||||
|
||||
// Temporary char array to pack into.
|
||||
const size_t mem_size = packed_size(bits);
|
||||
unique_ptr<char[]> mem = ue2::make_unique<char[]>(mem_size);
|
||||
unique_ptr<char[]> mem = std::make_unique<char[]>(mem_size);
|
||||
|
||||
pack_bits<T>(&mem[0], &v[0], &bits[0], elements);
|
||||
|
||||
|
@@ -34,7 +34,6 @@
|
||||
#include "nfa/repeat.h"
|
||||
#include "nfa/repeatcompile.h"
|
||||
#include "util/depth.h"
|
||||
#include "util/make_unique.h"
|
||||
|
||||
#include <algorithm>
|
||||
#include <memory>
|
||||
@@ -431,7 +430,7 @@ TEST_P(RepeatTest, Pack) {
|
||||
// We should be able to pack and then unpack the control block at any
|
||||
// offset up to repeatMin and get a match at both the min and max repeats.
|
||||
|
||||
unique_ptr<char[]> packed = ue2::make_unique<char[]>(info.packedCtrlSize);
|
||||
unique_ptr<char[]> packed = std::make_unique<char[]>(info.packedCtrlSize);
|
||||
|
||||
for (u32 i = 0; i < info.repeatMax; i++) {
|
||||
SCOPED_TRACE(testing::Message() << "i=" << i);
|
||||
|
@@ -39,7 +39,6 @@
|
||||
#include "util/boundary_reports.h"
|
||||
#include "util/compile_context.h"
|
||||
#include "util/graph_range.h"
|
||||
#include "util/make_unique.h"
|
||||
#include "smallwrite/smallwrite_build.h"
|
||||
#include "som/slot_manager.h"
|
||||
|
||||
@@ -52,7 +51,7 @@ using namespace ue2;
|
||||
|
||||
static
|
||||
std::unique_ptr<NGHolder> makeSuffixGraph(ReportID report) {
|
||||
auto h = ue2::make_unique<NGHolder>(NFA_SUFFIX);
|
||||
auto h = std::make_unique<NGHolder>(NFA_SUFFIX);
|
||||
NGHolder &g = *h;
|
||||
|
||||
NFAVertex v = add_vertex(g);
|
||||
|
@@ -894,6 +894,7 @@ TEST(DoubleShufti, ExecMatchMixed3) {
|
||||
for (size_t i = 0; i < 400; i++) {
|
||||
t2[len - i] = 'x';
|
||||
t2[len - i + 1] = 'y';
|
||||
DEBUG_PRINTF("i = %ld\n", i);
|
||||
const u8 *rv = shuftiDoubleExec(lo1, hi1, lo2, hi2,
|
||||
(u8 *)t2, (u8 *)t2 + len);
|
||||
|
||||
@@ -1106,6 +1107,7 @@ TEST(ReverseShufti, ExecMatch6) {
|
||||
|
||||
for (size_t i = 0; i < len; i++) {
|
||||
t1[i] = 'a';
|
||||
DEBUG_PRINTF("i=%ld\n", i);
|
||||
const u8 *rv = rshuftiExec(lo, hi, (u8 *)t1, (u8 *)t1 + len);
|
||||
|
||||
ASSERT_EQ((const u8 *)t1 + i, rv);
|
||||
|
@@ -31,7 +31,6 @@
|
||||
#include "gtest/gtest.h"
|
||||
#include "util/arch.h"
|
||||
#include "util/bytecode_ptr.h"
|
||||
#include "util/make_unique.h"
|
||||
#include "util/simd_utils.h"
|
||||
|
||||
using namespace std;
|
||||
@@ -522,7 +521,7 @@ TYPED_TEST(SimdUtilsTest, loadu) {
|
||||
const TypeParam ones = simd_ones();
|
||||
|
||||
const size_t mem_len = sizeof(ones) * 2;
|
||||
unique_ptr<char[]> mem_array = ue2::make_unique<char[]>(mem_len);
|
||||
unique_ptr<char[]> mem_array = std::make_unique<char[]>(mem_len);
|
||||
char *mem = mem_array.get();
|
||||
|
||||
for (size_t offset = 1; offset < sizeof(ones); offset++) {
|
||||
|
Reference in New Issue
Block a user