Use anonymous namespaces for INITIALIZE_ONCE().

Refs #5036
This commit is contained in:
Gunnar Beutner 2013-11-08 21:12:47 +01:00
parent 98c3431dda
commit 2a6151e935
6 changed files with 9 additions and 7 deletions

View File

@ -34,8 +34,10 @@ inline bool InitializeOnceHelper(InitializeFunc func)
return true;
}
#define INITIALIZE_ONCE(name, func) \
I2_EXPORT bool l_InitializeOnce ## name(InitializeOnceHelper(func))
#define INITIALIZE_ONCE(func) \
namespace { \
I2_EXPORT bool l_InitializeOnce(InitializeOnceHelper(func)); \
}
}

View File

@ -104,7 +104,7 @@ struct FactoryHelper
icinga::Type::Register(GetType<type>()); \
} \
\
INITIALIZE_ONCE(type, RegisterType); \
INITIALIZE_ONCE(RegisterType); \
}
}

View File

@ -35,7 +35,7 @@ REGISTER_TYPE(DbConnection);
Timer::Ptr DbConnection::m_ProgramStatusTimer;
INITIALIZE_ONCE(DbConnection, &DbConnection::StaticInitialize);
INITIALIZE_ONCE(&DbConnection::StaticInitialize);
void DbConnection::Start(void)
{

View File

@ -32,7 +32,7 @@ using namespace icinga;
boost::signals2::signal<void (const DbQuery&)> DbObject::OnQuery;
INITIALIZE_ONCE(DbObject, &DbObject::StaticInitialize);
INITIALIZE_ONCE(&DbObject::StaticInitialize);
DbObject::DbObject(const shared_ptr<DbType>& type, const String& name1, const String& name2)
: m_Name1(name1), m_Name2(name2), m_Type(type), m_LastConfigUpdate(0), m_LastStatusUpdate(0)

View File

@ -38,7 +38,7 @@ using namespace icinga;
REGISTER_DBTYPE(Service, "service", DbObjectTypeService, "service_object_id", ServiceDbObject);
INITIALIZE_ONCE(ServiceDbObject, &ServiceDbObject::StaticInitialize);
INITIALIZE_ONCE(&ServiceDbObject::StaticInitialize);
void ServiceDbObject::StaticInitialize(void)
{

View File

@ -33,7 +33,7 @@ using namespace icinga;
static Timer::Ptr l_RetentionTimer;
REGISTER_TYPE(IcingaApplication);
INITIALIZE_ONCE(IcingaApplication, &IcingaApplication::StaticInitialize);
INITIALIZE_ONCE(&IcingaApplication::StaticInitialize);
void IcingaApplication::StaticInitialize(void)
{