most ptr.get() conversion

This commit is contained in:
gtsoul-tech 2024-05-13 14:24:16 +03:00
parent fc272868b8
commit 9798b57f9e
6 changed files with 24 additions and 24 deletions

View File

@ -250,7 +250,7 @@ int main(){
u32 id = 1000;
ue2::hwlmLiteral lit(str, true, id);
b.nt = ue2::noodBuildTable(lit);
assert(b.nt != nullptr);
assert(b.nt.get() != nullptr);
},
[&](MicroBenchmark &b) {
noodExec(b.nt.get(), b.buf.data(), b.size, 0,

View File

@ -505,7 +505,7 @@ bool operator<(const RoseEdgeProps &a, const RoseEdgeProps &b) {
#ifndef NDEBUG
bool roseHasTops(const RoseBuildImpl &build, RoseVertex v) {
const RoseGraph &g = build.g;
assert(left_id(g[v].left));
assert(g[v].left);
set<u32> graph_tops;
if (!build.isRootSuccessor(v)) {

View File

@ -915,7 +915,7 @@ bool mergeSameCastle(RoseBuildImpl &build, RoseVertex a, RoseVertex b,
}
}
assert(contains(rai.rev_leftfix[b_left], b));
assert(contains(rai.rev_leftfix[left_id(b_left)], b));
rai.rev_leftfix[left_id(b_left)].erase(b);
rai.rev_leftfix[left_id(a_left)].insert(b);

View File

@ -61,10 +61,10 @@ using namespace ue2;
#define CHECK_WITH_TEDDY_OK_TO_FAIL(fdr, hint) \
{ \
auto descr = getTeddyDescription(hint); \
if (descr && fdr == nullptr) { \
if (descr && fdr.get() == nullptr) { \
return; /* cannot build Teddy for this set of literals */ \
} else { \
ASSERT_TRUE(fdr != nullptr); \
ASSERT_TRUE(fdr.get() != nullptr); \
} \
}
#endif
@ -145,7 +145,7 @@ bytecode_ptr<FDR> buildFDREngineHinted(std::vector<hwlmLiteral> &lits,
auto proto = fdrBuildProtoHinted(HWLM_ENGINE_FDR, lits, make_small, hint,
target, grey);
if (!proto) {
return nullptr;
return ue2::bytecode_ptr<FDR>(nullptr);
}
return fdrBuildTable(*proto, grey);
}
@ -156,7 +156,7 @@ bytecode_ptr<FDR> buildFDREngine(std::vector<hwlmLiteral> &lits,
const Grey &grey) {
auto proto = fdrBuildProto(HWLM_ENGINE_FDR, lits, make_small, target, grey);
if (!proto) {
return nullptr;
return bytecode_ptr<FDR>(nullptr);
}
return fdrBuildTable(*proto, grey);
}
@ -421,7 +421,7 @@ TEST_P(FDRp, moveByteStream) {
size_t size = fdrSize(fdrTable0.get());
auto fdrTable = make_bytecode_ptr<FDR>(size, 64);
EXPECT_NE(nullptr, fdrTable);
EXPECT_NE(nullptr, fdrTable.get());
memcpy(fdrTable.get(), fdrTable0.get(), size);
@ -706,7 +706,7 @@ TEST(FDR, FDRTermS) {
lits.push_back(hwlmLiteral("ff", 0, 1));
auto fdr = buildFDREngine(lits, false, get_current_target(), Grey());
ASSERT_TRUE(fdr != nullptr);
ASSERT_TRUE(fdr.get() != nullptr);
// check matches
@ -729,7 +729,7 @@ TEST(FDR, FDRTermB) {
lits.push_back(hwlmLiteral("ff", 0, 1));
auto fdr = buildFDREngine(lits, false, get_current_target(), Grey());
ASSERT_TRUE(fdr != nullptr);
ASSERT_TRUE(fdr.get() != nullptr);
// check matches
struct hs_scratch scratch;

View File

@ -55,10 +55,10 @@ using namespace ue2;
#define CHECK_WITH_TEDDY_OK_TO_FAIL(fdr, hint) \
{ \
auto descr = getTeddyDescription(hint); \
if (descr && fdr != nullptr) { \
if (descr && fdr.get() != nullptr) { \
return; \
} else { \
ASSERT_TRUE(fdr != nullptr); \
ASSERT_TRUE(fdr.get() != nullptr); \
} \
}
#endif

View File

@ -87,7 +87,7 @@ protected:
nfa = constructNFA(*g, &rm, fixed_depth_tops, triggers, compress_state,
fast_nfa, type, cc);
ASSERT_TRUE(nfa != nullptr);
ASSERT_TRUE(nfa.get() != nullptr);
full_state = make_bytecode_ptr<char>(nfa->scratchStateSize, 64);
stream_state = make_bytecode_ptr<char>(nfa->streamStateSize);
@ -134,7 +134,7 @@ INSTANTIATE_TEST_CASE_P(
Range((int)LIMEX_NFA_32, (int)LIMEX_NFA_512));
TEST_P(LimExModelTest, StateSize) {
ASSERT_TRUE(nfa != nullptr);
ASSERT_TRUE(nfa.get() != nullptr);
hs_platform_info plat;
hs_error_t err = hs_populate_platform(&plat);
@ -150,7 +150,7 @@ TEST_P(LimExModelTest, StateSize) {
}
TEST_P(LimExModelTest, QueueExec) {
ASSERT_TRUE(nfa != nullptr);
ASSERT_TRUE(nfa.get() != nullptr);
initQueue();
nfaQueueInitState(nfa.get(), &q);
@ -165,7 +165,7 @@ TEST_P(LimExModelTest, QueueExec) {
}
TEST_P(LimExModelTest, CompressExpand) {
ASSERT_TRUE(nfa != nullptr);
ASSERT_TRUE(nfa.get() != nullptr);
u32 real_state_size = nfa->scratchStateSize;
/* Only look at 8 bytes for limex 64 (rather than the padding) */
@ -197,7 +197,7 @@ TEST_P(LimExModelTest, CompressExpand) {
}
TEST_P(LimExModelTest, InitCompressedState0) {
ASSERT_TRUE(nfa != nullptr);
ASSERT_TRUE(nfa.get() != nullptr);
// 64-bit NFAs assume during compression that they have >= 5 bytes of
// compressed NFA state, which isn't true for our 8-state test pattern. We
@ -212,7 +212,7 @@ TEST_P(LimExModelTest, InitCompressedState0) {
}
TEST_P(LimExModelTest, QueueExecToMatch) {
ASSERT_TRUE(nfa != nullptr);
ASSERT_TRUE(nfa.get() != nullptr);
initQueue();
nfaQueueInitState(nfa.get(), &q);
@ -256,7 +256,7 @@ TEST_P(LimExModelTest, QueueExecToMatch) {
}
TEST_P(LimExModelTest, QueueExecRose) {
ASSERT_TRUE(nfa != nullptr);
ASSERT_TRUE(nfa.get() != nullptr);
initQueue();
// For rose, there's no callback or context.
@ -277,7 +277,7 @@ TEST_P(LimExModelTest, QueueExecRose) {
}
TEST_P(LimExModelTest, CheckFinalState) {
ASSERT_TRUE(nfa != nullptr);
ASSERT_TRUE(nfa.get() != nullptr);
initQueue();
nfaQueueInitState(nfa.get(), &q);
@ -321,7 +321,7 @@ protected:
}
nfa = constructReversedNFA(g_rev, type, cc);
ASSERT_TRUE(nfa != nullptr);
ASSERT_TRUE(nfa.get() != nullptr);
}
// NFA type (enum NFAEngineType)
@ -338,7 +338,7 @@ INSTANTIATE_TEST_CASE_P(LimExReverse, LimExReverseTest,
Range((int)LIMEX_NFA_32, (int)LIMEX_NFA_512));
TEST_P(LimExReverseTest, BlockExecReverse) {
ASSERT_TRUE(nfa != nullptr);
ASSERT_TRUE(nfa.get() != nullptr);
u64a offset = 0;
const u8 *buf = (const u8 *)SCAN_DATA.c_str();
@ -381,7 +381,7 @@ protected:
nfa = constructNFA(*g, &rm, fixed_depth_tops, triggers, compress_state,
fast_nfa, type, cc);
ASSERT_TRUE(nfa != nullptr);
ASSERT_TRUE(nfa.get() != nullptr);
full_state = make_bytecode_ptr<char>(nfa->scratchStateSize, 64);
stream_state = make_bytecode_ptr<char>(nfa->streamStateSize);
@ -427,7 +427,7 @@ INSTANTIATE_TEST_CASE_P(LimExZombie, LimExZombieTest,
Range((int)LIMEX_NFA_32, (int)LIMEX_NFA_512));
TEST_P(LimExZombieTest, GetZombieStatus) {
ASSERT_TRUE(nfa != nullptr);
ASSERT_TRUE(nfa.get() != nullptr);
ASSERT_TRUE(nfa->flags & NFA_ZOMBIE);
initQueue();