[recursive space map] switch to new form 'for' statements

This commit is contained in:
Joe Thornber 2020-05-26 07:49:26 +01:00
parent 0e1700fbe9
commit 5e6eec1bb0

View File

@ -75,9 +75,8 @@ namespace {
op_map::const_iterator ops_it = ops_.find(b); op_map::const_iterator ops_it = ops_.find(b);
if (ops_it != ops_.end()) { if (ops_it != ops_.end()) {
list<block_op>::const_iterator it, end = ops_it->second.end(); for (auto const &op : ops_it->second) {
for (it = ops_it->second.begin(); it != end; ++it) { switch (op.op_) {
switch (it->op_) {
case block_op::INC: case block_op::INC:
count++; count++;
break; break;
@ -87,7 +86,7 @@ namespace {
break; break;
case block_op::SET: case block_op::SET:
count = it->b_; count = op.b_;
break; break;
} }
} }
@ -145,9 +144,8 @@ namespace {
// FIXME: duplication // FIXME: duplication
op_map::const_iterator ops_it = ops_.find(b); op_map::const_iterator ops_it = ops_.find(b);
if (ops_it != ops_.end()) { if (ops_it != ops_.end()) {
list<block_op>::const_iterator it, end = ops_it->second.end(); for (auto const &op : ops_it->second) {
for (it = ops_it->second.begin(); it != end; ++it) { switch (op.op_) {
switch (it->op_) {
case block_op::INC: case block_op::INC:
count++; count++;
break; break;
@ -157,7 +155,7 @@ namespace {
break; break;
case block_op::SET: case block_op::SET:
count = it->b_; count = op.b_;
break; break;
} }
} }
@ -216,24 +214,21 @@ namespace {
private: private:
void flush_ops_() { void flush_ops_() {
op_map::const_iterator it, end = ops_.end(); for (auto const &block_ops : ops_) {
for (it = ops_.begin(); it != end; ++it) {
recursing_lock lock(*this); recursing_lock lock(*this);
list<block_op> const &ops = it->second; for (auto const &op : block_ops.second) {
list<block_op>::const_iterator op_it, op_end = ops.end(); switch (op.op_) {
for (op_it = ops.begin(); op_it != op_end; ++op_it) {
switch (op_it->op_) {
case block_op::INC: case block_op::INC:
sm_->inc(op_it->b_); sm_->inc(op.b_);
break; break;
case block_op::DEC: case block_op::DEC:
sm_->dec(op_it->b_); sm_->dec(op.b_);
break; break;
case block_op::SET: case block_op::SET:
sm_->set_count(op_it->b_, op_it->rc_); sm_->set_count(op.b_, op.rc_);
break; break;
} }
} }