mirror of
https://github.com/Ardour/ardour.git
synced 2025-12-06 23:05:04 +01:00
add safety checking when setting up DEBUG bits
This commit is contained in:
parent
159d23be9f
commit
b00d75adf6
1 changed files with 15 additions and 3 deletions
|
|
@ -74,9 +74,21 @@ DebugBits PBD::debug_bits;
|
||||||
DebugBits
|
DebugBits
|
||||||
PBD::new_debug_bit (const char* name)
|
PBD::new_debug_bit (const char* name)
|
||||||
{
|
{
|
||||||
DebugBits ret;
|
DebugBits ret;
|
||||||
ret.set (_debug_bit++, 1);
|
DebugMap::iterator i =_debug_bit_map().find (name);
|
||||||
_debug_bit_map().insert (make_pair (name, ret));
|
|
||||||
|
if (i != _debug_bit_map().end()) {
|
||||||
|
return i->second;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (_debug_bit >= debug_bits.size()) {
|
||||||
|
cerr << "Too many debug bits defined, offender was " << name << endl;
|
||||||
|
abort ();
|
||||||
|
/*NOTREACHED*/
|
||||||
|
}
|
||||||
|
|
||||||
|
ret.set (_debug_bit++, 1);
|
||||||
|
_debug_bit_map().insert (make_pair (name, ret));
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue