Skip to content

Commit 1fd2ba2

Browse files
committed
style(graph, ahocorasick): fix formatting and add clang-tidy suppress comments
1 parent 1440ac2 commit 1fd2ba2

2 files changed

Lines changed: 7 additions & 1 deletion

File tree

engine/src/ahocorasick.h

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -124,6 +124,11 @@ class ACAutomaton {
124124
int best_len = 0;
125125
for (const char *p = text; *p; p++) {
126126
int idx = static_cast<unsigned char>(*p);
127+
// Follow failure links until we find a node with a
128+
// child for this character, or reach the root.
129+
// `next` is a fixed-size array (Node*[256]), so
130+
// `!next[idx]` is a valid null-element check, not a
131+
// null-pointer dereference (clang-tidy false positive).
127132
while (cur != &root_ && !cur->next[idx])
128133
cur = cur->fail;
129134
if (cur->next[idx])

engine/src/graph/graph_builder.cpp

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,8 @@ namespace graph
1111
// state_builder) treat them as reachable roots instead of orphans.
1212
// Go's `init` is an implicit entry point executed at package load.
1313
// [module=graph, method=isEntryPointName]
14-
static bool isEntryPointName(const std::string &name, const std::string &language)
14+
static bool isEntryPointName(const std::string &name,
15+
const std::string &language)
1516
{
1617
if (name == "main") {
1718
return language == "c" || language == "cpp" ||

0 commit comments

Comments
 (0)