Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(370)

Unified Diff: sandbox/linux/seccomp-bpf/codegen.cc

Issue 652123002: sandbox_bpf: Remove Traverse method. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 6 years, 2 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « sandbox/linux/seccomp-bpf/codegen.h ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: sandbox/linux/seccomp-bpf/codegen.cc
diff --git a/sandbox/linux/seccomp-bpf/codegen.cc b/sandbox/linux/seccomp-bpf/codegen.cc
index 2273cafe7b3ec9e16b5198d3fdd2469c70a5418d..9c347930f3f07481e509e2369fa68ddf7e15958c 100644
--- a/sandbox/linux/seccomp-bpf/codegen.cc
+++ b/sandbox/linux/seccomp-bpf/codegen.cc
@@ -14,31 +14,6 @@
#include "sandbox/linux/seccomp-bpf/instruction.h"
#include "sandbox/linux/seccomp-bpf/linux_seccomp.h"
-namespace {
-
-// Helper function for Traverse().
-void TraverseRecursively(std::set<sandbox::Instruction*>* visited,
- sandbox::Instruction* instruction) {
- if (visited->find(instruction) == visited->end()) {
- visited->insert(instruction);
- switch (BPF_CLASS(instruction->code)) {
- case BPF_JMP:
- if (BPF_OP(instruction->code) != BPF_JA) {
- TraverseRecursively(visited, instruction->jf_ptr);
- }
- TraverseRecursively(visited, instruction->jt_ptr);
- break;
- case BPF_RET:
- break;
- default:
- TraverseRecursively(visited, instruction->next);
- break;
- }
- }
-}
-
-} // namespace
-
namespace sandbox {
CodeGen::CodeGen() : compiled_(false) {}
@@ -189,18 +164,6 @@ Instruction* CodeGen::MakeInstruction(uint16_t code,
return insn;
}
-void CodeGen::Traverse(Instruction* instruction,
- void (*fnc)(Instruction*, void*),
- void* aux) {
- std::set<Instruction*> visited;
- TraverseRecursively(&visited, instruction);
- for (std::set<Instruction*>::const_iterator iter = visited.begin();
- iter != visited.end();
- ++iter) {
- fnc(*iter, aux);
- }
-}
-
void CodeGen::FindBranchTargets(const Instruction& instructions,
BranchTargets* branch_targets) {
// Follow all possible paths through the "instructions" graph and compute
« no previous file with comments | « sandbox/linux/seccomp-bpf/codegen.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698