From c087472c716b1e8b76be8677be243d6568007b0a Mon Sep 17 00:00:00 2001 From: Eelco Dolstra Date: Mon, 2 Nov 2015 14:29:12 +0100 Subject: [PATCH] Remove superfluous "has" function --- src/hydra-queue-runner/hydra-queue-runner.cc | 2 +- src/hydra-queue-runner/queue-monitor.cc | 2 +- src/hydra-queue-runner/state.hh | 7 ------- 3 files changed, 2 insertions(+), 9 deletions(-) diff --git a/src/hydra-queue-runner/hydra-queue-runner.cc b/src/hydra-queue-runner/hydra-queue-runner.cc index 51b26336..582a06ea 100644 --- a/src/hydra-queue-runner/hydra-queue-runner.cc +++ b/src/hydra-queue-runner/hydra-queue-runner.cc @@ -249,7 +249,7 @@ void getDependents(Step::ptr step, std::set & builds, std::set visit; visit = [&](Step::ptr step) { - if (has(steps, step)) return; + if (steps.count(step)) return; steps.insert(step); std::vector rdeps; diff --git a/src/hydra-queue-runner/queue-monitor.cc b/src/hydra-queue-runner/queue-monitor.cc index 8bce7aab..be8d5137 100644 --- a/src/hydra-queue-runner/queue-monitor.cc +++ b/src/hydra-queue-runner/queue-monitor.cc @@ -89,7 +89,7 @@ bool State::getQueuedBuilds(Connection & conn, std::shared_ptr store, BuildID id = row["id"].as(); if (buildOne && id != buildOne) continue; if (id > newLastBuildId) newLastBuildId = id; - if (has(*builds_, id)) continue; + if (builds_->count(id)) continue; auto build = std::make_shared(); build->id = id; diff --git a/src/hydra-queue-runner/state.hh b/src/hydra-queue-runner/state.hh index 1a988076..e5fd8aae 100644 --- a/src/hydra-queue-runner/state.hh +++ b/src/hydra-queue-runner/state.hh @@ -439,10 +439,3 @@ public: void run(BuildID buildOne = 0); }; - - -template -bool has(const C & c, const V & v) -{ - return c.find(v) != c.end(); -}