aboutsummaryrefslogtreecommitdiffstats
path: root/contrib/libs/hyperscan/src/nfagraph/ng_edge_redundancy.cpp
diff options
context:
space:
mode:
authorIvan Blinkov <ivan@blinkov.ru>2022-02-10 16:47:11 +0300
committerDaniil Cherednik <dcherednik@yandex-team.ru>2022-02-10 16:47:11 +0300
commit5b283123c882433dafbaf6b338adeea16c1a0ea0 (patch)
tree339adc63bce23800021202ae4a8328a843dc447a /contrib/libs/hyperscan/src/nfagraph/ng_edge_redundancy.cpp
parent1aeb9a455974457866f78722ad98114bafc84e8a (diff)
downloadydb-5b283123c882433dafbaf6b338adeea16c1a0ea0.tar.gz
Restoring authorship annotation for Ivan Blinkov <ivan@blinkov.ru>. Commit 2 of 2.
Diffstat (limited to 'contrib/libs/hyperscan/src/nfagraph/ng_edge_redundancy.cpp')
-rw-r--r--contrib/libs/hyperscan/src/nfagraph/ng_edge_redundancy.cpp62
1 files changed, 31 insertions, 31 deletions
diff --git a/contrib/libs/hyperscan/src/nfagraph/ng_edge_redundancy.cpp b/contrib/libs/hyperscan/src/nfagraph/ng_edge_redundancy.cpp
index 3a1940d912..b8354bd42a 100644
--- a/contrib/libs/hyperscan/src/nfagraph/ng_edge_redundancy.cpp
+++ b/contrib/libs/hyperscan/src/nfagraph/ng_edge_redundancy.cpp
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2015-2017, Intel Corporation
+ * Copyright (c) 2015-2017, Intel Corporation
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are met:
@@ -38,7 +38,7 @@
#include "parser/position.h"
#include "util/compile_context.h"
#include "util/container.h"
-#include "util/flat_containers.h"
+#include "util/flat_containers.h"
#include "util/graph_range.h"
#include <set>
@@ -181,28 +181,28 @@ bool removeEdgeRedundancyNearCyclesFwd(NGHolder &g, bool ignore_starts) {
return dead_count;
}
-static
-bool checkReportsRev(const NGHolder &g, NFAVertex v,
- const set<NFAVertex> &happy) {
- if (g[v].reports.empty()) {
- return true;
- }
-
- assert(edge(v, g.accept, g).second || edge(v, g.acceptEod, g).second);
-
- /* an edge to accept takes priority over eod only accept */
- NFAVertex accept = edge(v, g.accept, g).second ? g.accept : g.acceptEod;
-
- flat_set<ReportID> happy_reports;
- for (NFAVertex u : happy) {
- if (edge(u, accept, g).second) {
- insert(&happy_reports, g[u].reports);
- }
- }
-
- return is_subset_of(g[v].reports, happy_reports);
-}
-
+static
+bool checkReportsRev(const NGHolder &g, NFAVertex v,
+ const set<NFAVertex> &happy) {
+ if (g[v].reports.empty()) {
+ return true;
+ }
+
+ assert(edge(v, g.accept, g).second || edge(v, g.acceptEod, g).second);
+
+ /* an edge to accept takes priority over eod only accept */
+ NFAVertex accept = edge(v, g.accept, g).second ? g.accept : g.acceptEod;
+
+ flat_set<ReportID> happy_reports;
+ for (NFAVertex u : happy) {
+ if (edge(u, accept, g).second) {
+ insert(&happy_reports, g[u].reports);
+ }
+ }
+
+ return is_subset_of(g[v].reports, happy_reports);
+}
+
/** \brief Redundant self-loop removal (reverse version).
*
* A self loop on a vertex v can be removed if:
@@ -255,8 +255,8 @@ bool removeEdgeRedundancyNearCyclesRev(NGHolder &g) {
happy.insert(u);
}
- if (!happy.empty() && checkVerticesRev(g, sad, happy)
- && checkReportsRev(g, v, happy)) {
+ if (!happy.empty() && checkVerticesRev(g, sad, happy)
+ && checkReportsRev(g, v, happy)) {
dead_count++;
remove_edge(v, v, g);
}
@@ -320,8 +320,8 @@ bool checkFwdCandidate(const NGHolder &g, NFAVertex fixed_src,
return false;
}
- DEBUG_PRINTF("edge (%zu, %zu) killed by edge (%zu, %zu)\n",
- g[w].index, g[v].index, g[fixed_src].index, g[v].index);
+ DEBUG_PRINTF("edge (%zu, %zu) killed by edge (%zu, %zu)\n",
+ g[w].index, g[v].index, g[fixed_src].index, g[v].index);
return true;
}
@@ -437,7 +437,7 @@ bool removeEdgeRedundancyFwd(NGHolder &g, bool ignore_starts) {
pred(g, u, &parents_u);
done.clear();
- if (out_degree(u, g) > 1) {
+ if (out_degree(u, g) > 1) {
checkLargeOutU(g, u, parents_u, possible_w, done, &dead);
} else {
checkSmallOutU(g, u, parents_u, done, &dead);
@@ -482,7 +482,7 @@ bool removeSiblingsOfStartDotStar(NGHolder &g) {
vector<NFAEdge> dead;
for (auto v : adjacent_vertices_range(g.startDs, g)) {
- DEBUG_PRINTF("checking %zu\n", g[v].index);
+ DEBUG_PRINTF("checking %zu\n", g[v].index);
if (is_special(v, g)) {
continue;
}
@@ -492,7 +492,7 @@ bool removeSiblingsOfStartDotStar(NGHolder &g) {
if (is_special(u, g)) {
continue;
}
- DEBUG_PRINTF("removing %zu->%zu\n", g[u].index, g[v].index);
+ DEBUG_PRINTF("removing %zu->%zu\n", g[u].index, g[v].index);
dead.push_back(e);
}
}