MCPcopy Create free account
hub / github.com/FirebirdSQL/firebird / Recolor

Method Recolor

extern/re2/re2/prog.cc:426–442  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

424}
425
426int ByteMapBuilder::Recolor(int oldcolor) {
427 // Yes, this is a linear search. There can be at most 256
428 // colors and there will typically be far fewer than that.
429 // Also, we need to consider keys *and* values in order to
430 // avoid recoloring a given range more than once per batch.
431 std::vector<std::pair<int, int>>::const_iterator it =
432 std::find_if(colormap_.begin(), colormap_.end(),
433 [=](const std::pair<int, int>& kv) -> bool {
434 return kv.first == oldcolor || kv.second == oldcolor;
435 });
436 if (it != colormap_.end())
437 return it->second;
438 int newcolor = nextcolor_;
439 nextcolor_++;
440 colormap_.emplace_back(oldcolor, newcolor);
441 return newcolor;
442}
443
444void Prog::ComputeByteMap() {
445 // Fill in bytemap with byte classes for the program.

Callers

nothing calls this directly

Calls 4

find_ifFunction · 0.85
emplace_backMethod · 0.80
beginMethod · 0.45
endMethod · 0.45

Tested by

no test coverage detected