X-Git-Url: https://main.carlh.net/gitweb/?a=blobdiff_plain;f=libs%2Fpbd%2Fdebug.cc;h=419c5bfb379e32ec71fe3bc8511a80834d6db28a;hb=cf52d6e4b40111eb04b244ec054055a4ec15dbe0;hp=af8cd052cde2f594d20bef79308b2739176daa5f;hpb=22b07e0233a29d9633ffa825a79503befaf2e16e;p=ardour.git diff --git a/libs/pbd/debug.cc b/libs/pbd/debug.cc index af8cd052cd..419c5bfb37 100644 --- a/libs/pbd/debug.cc +++ b/libs/pbd/debug.cc @@ -28,7 +28,7 @@ #include "pbd/debug.h" -#include "i18n.h" +#include "pbd/i18n.h" using namespace std; using PBD::DebugBits; @@ -56,6 +56,7 @@ DebugBits PBD::DEBUG::Configuration = PBD::new_debug_bit ("configuration"); DebugBits PBD::DEBUG::UndoHistory = PBD::new_debug_bit ("undohistory"); DebugBits PBD::DEBUG::Timing = PBD::new_debug_bit ("timing"); DebugBits PBD::DEBUG::Threads = PBD::new_debug_bit ("threads"); +DebugBits PBD::DEBUG::Locale = PBD::new_debug_bit ("locale"); /* These are debug bits that are used by backends. Since these are loaded dynamically, after command-line parsing, defining them in code that is part of the backend @@ -74,9 +75,21 @@ DebugBits PBD::debug_bits; DebugBits PBD::new_debug_bit (const char* name) { - DebugBits ret; - ret.set (_debug_bit++, 1); - _debug_bit_map().insert (make_pair (name, ret)); + DebugBits ret; + DebugMap::iterator i =_debug_bit_map().find (name); + + 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; }